public void Delete(int id)
 {
     try
     {
         aircraftService.DeleteAircraft(id);
     }
     catch (System.Exception)
     {
         HttpContext.Response.StatusCode = 404;
     }
 }
 public async Task Delete(int id)
 {
     try
     {
         HttpContext.Response.StatusCode = 204;
         await aircraftService.DeleteAircraft(id);
     }
     catch (System.Exception)
     {
         HttpContext.Response.StatusCode = 404;
     }
 }
 public void TestSetup()
 {
     A.CallTo(() => fakeAircraftService.AddAircraft(A <AircraftDTO> ._)).Invokes((AircraftDTO a) => { a.Id = Aircrafts.Count + 1; Aircrafts.Add(a); });
     A.CallTo(() => fakeAircraftService.DeleteAircraft(A <int> ._)).Invokes((int id) => Aircrafts.RemoveAll(a => a.Id == id));
     A.CallTo(() => fakeAircraftService.UpdateAircraft(A <int> ._, A <AircraftDTO> ._)).Returns(Aircrafts.FirstOrDefault());
     A.CallTo(() => fakeAircraftService.GetAircraft(A <int> ._)).Returns(Aircrafts.FirstOrDefault());
     A.CallTo(() => fakeAircraftService.GetAllAircrafts()).Returns(Aircrafts);
     A.CallTo(() => fakeAircraftRepository.Create(A <Aircraft> ._));
     A.CallTo(() => fakeAircraftRepository.Update(A <int> ._, A <Aircraft> ._));
     A.CallTo(() => fakeAircraftRepository.Delete(A <int> ._));
     A.CallTo(() => fakeAircraftRepository.GetById(A <int> ._));
     A.CallTo(() => fakeAircraftRepository.GetAll());
     A.CallTo(() => fakeUnitOfWork.Aircrafts).Returns(fakeAircraftRepository);
 }
Beispiel #4
0
 public IActionResult DeleteAircraftById(Guid aircraftId)
 {
     _aircraftService.DeleteAircraft(aircraftId);
     return(NoContent());
 }
 public async Task <IActionResult> Delete(int id)
 {
     return(Ok(await _aircraftService.DeleteAircraft(id)));
 }