removed old BedrijfController and the folder structure associated with it
This commit is contained in:
parent
fa3ac2dd0e
commit
23f35b17c0
@ -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<ActionResult<IEnumerable<Bedrijf>>> getBedrijven()
|
||||
{
|
||||
return await _context.Bedrijf
|
||||
.Select(x => bedrijfData(x))
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("{Bedrijf_ID}")]
|
||||
public async Task<ActionResult<Bedrijf>> 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<IEnumerable<Bedrijf>> GetBedrijf(int Bedrijf_ID)
|
||||
{
|
||||
return await _context.Bedrijf.Where(B => B.Bedrijf_ID == Bedrijf_ID).ToListAsync();
|
||||
// return getBedrijf;
|
||||
}*/
|
||||
|
||||
// GET: api/<BedrijfController>
|
||||
/* [HttpGet]
|
||||
public IEnumerable<string> Get()
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
}
|
||||
|
||||
// GET api/<BedrijfController>/5
|
||||
[HttpGet("{id}")]
|
||||
public string Get(int id)
|
||||
{
|
||||
return "value";
|
||||
}
|
||||
|
||||
// POST api/<BedrijfController>
|
||||
[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
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user