public async Task Delete_WhenNull_ReturNoFound() { AircraftDto aircraft = new AircraftDto(); A.CallTo(() => service.Delete(aircraft.Id)).Returns(false); IActionResult result = await aircraftsController.Delete(aircraft.Id); Assert.True(result is NotFoundResult); }
public IActionResult Delete(int id) { bool result = service.Delete(id); if (!result) { return(NotFound()); } return(NoContent()); }
public async Task <IActionResult> Delete(int id) { bool result = await service.Delete(id); if (!result) { return(NotFound()); } return(NoContent()); }
public ActionResult Delete(string model) { try { AircraftService.Delete(model); return(Ok()); } catch (Exception ex) { logger.LogError(1, ex, "No Aircraft found with iATA code {1}", model); return(NotFound($"No Aircraft found with iATA code {model}")); } }