diff --git a/AlfaPrentice/Controllers/BedrijfController.cs b/AlfaPrentice/Controllers/BedrijfController.cs deleted file mode 100644 index 1995db2..0000000 --- a/AlfaPrentice/Controllers/BedrijfController.cs +++ /dev/null @@ -1,91 +0,0 @@ -using AlfaPrentice.Data; -using AlfaPrentice.Models; -using AlfaPrentice.Repositorys.Interfaces; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 - -namespace AlfaPrentice.Controllers -{ - [Route("api/[controller]")] - [ApiController] - public class BedrijfController : ControllerBase - { - //constructor - public readonly AlfaPrenticeContext _context; - public IBedrijfRepository bedrijfRepo; - public BedrijfController(AlfaPrenticeContext context, IBedrijfRepository bedrijfRepo) - { - this.bedrijfRepo = bedrijfRepo; - _context = context; - } - - [HttpGet] - public async Task>> getBedrijven() - { - return await _context.Bedrijf - .Select(x => bedrijfData(x)) - .ToListAsync(); - } - - - [HttpGet("{Bedrijf_ID}")] - public async Task> GetBedrijf(int Bedrijf_ID) - { - var bedrijf = await _context.Bedrijf.FindAsync(Bedrijf_ID); - if (bedrijf == null) - { - return NotFound(); - } - return bedrijfData(bedrijf); - - } - - - /* //getbedrijf - [HttpGet("{Bedrijf_ID}")] - public async Task> GetBedrijf(int Bedrijf_ID) - { - return await _context.Bedrijf.Where(B => B.Bedrijf_ID == Bedrijf_ID).ToListAsync(); - // return getBedrijf; - }*/ - - // GET: api/ - /* [HttpGet] - public IEnumerable Get() - { - return new string[] { "value1", "value2" }; - } - - // GET api//5 - [HttpGet("{id}")] - public string Get(int id) - { - return "value"; - } - - // POST api/ - [HttpPost] - public void Post([FromBody] string value) - { - }*/ - - private static Bedrijf bedrijfData(Bedrijf bedrijf) => - new Bedrijf - { - Bedrijf_ID = bedrijf.Bedrijf_ID, - Naam = bedrijf.Naam, - Logo = bedrijf.Logo, - Beschrijving = bedrijf.Beschrijving, - Email = bedrijf.Email, - Telefoon = bedrijf.Telefoon, - Status = bedrijf.Status, - Adres_ID = bedrijf.Adres_ID - }; - } -}