public ActionResult DeletePost(int id) { try { airportService.Delete(id); } catch (Exception ex) { ModelState.AddModelError("Error", ex); } return(RedirectToAction("Index")); }
public ActionResult Delete(string iataCode) { try { airportService.Delete(iataCode); return(Ok()); } catch (Exception ex) { logger.LogError(1, ex, "No airport found with iATA code {1}", iataCode); return(NotFound($"No airport found with iATA code {iataCode}")); } }
public async Task <ActionResult <AirportViewModel> > Delete(Guid id) { var airport = await _airportService.GetById(id); if (airport == null) { _logger.LogInformation($"Airport id = {id} not found."); return(NotFound()); } await _airportService.Delete(airport); return(Ok(airport)); }
public void Delete_GivenNonExistentAirportId_ThrowsAnException() { mockRepository.Setup(m => m.Get(It.IsAny <Int32>())).Returns(() => null); Assert.Throws <Exception>(() => airportService.Delete(1)); }
public IActionResult DeleteConfirmed(int id) { _airportService.Delete(id); return(RedirectToAction(nameof(Index))); }
public virtual void Delete(int id) { service.Delete(id); }