public IHttpActionResult Post(FlightRequest flight) { if (_flightService.Query().Any(f => f.To.AirportCode == flight.To.Airport && f.To.City == flight.To.City && f.To.Country == flight.To.Country && f.From.AirportCode == flight.From.Airport && f.From.City == flight.From.City && f.From.Country == flight.From.Country && f.ArrivalTime == flight.ArrivalTime && f.DepartureTime == flight.DepartureTime && f.Carrier == flight.Carrier)) { Flight userFlight = _flightService.Query().FirstOrDefault(f => f.To.AirportCode == flight.To.Airport && f.To.City == flight.To.City && f.To.Country == flight.To.Country && f.From.AirportCode == flight.From.Airport && f.From.City == flight.From.City && f.From.Country == flight.From.Country && f.ArrivalTime == flight.ArrivalTime && f.DepartureTime == flight.DepartureTime && f.Carrier == flight.Carrier); _flightService.Delete(userFlight); } return(Ok()); }
public async Task <IActionResult> DeleteConfirmed(int id) { await _service.Delete(id); await _signalrHub.Clients.All.SendAsync("LoadFlights"); return(RedirectToAction(nameof(Index))); }
public async Task<ActionResult> Delete(int id) { var success = await _flightService.Delete(id); if (success) { return Ok(); } return BadRequest(); }
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 async Task <IActionResult> Delete(int id) { try { await service.Delete(id); } catch (ValidationException e) { return(BadRequest(new { Exception = e.Message })); } return(NoContent()); }
public IActionResult Delete(Guid id) { try { flightService.Delete(id); } catch (Exception ex) { return(BadRequest(new { Type = ex.GetType().Name, ex.Message })); } return(NoContent()); }
public async Task <ActionResult <FlightViewModel> > Delete(Guid id) { var flight = await _flightService.GetById(id); if (flight == null) { _logger.LogInformation($"Flight id = {id} not found."); return(NotFound()); } await _flightService.Delete(flight); return(Ok(flight)); }
public IActionResult DeleteConfirmed(int id) { _flightService.Delete(id); return(RedirectToAction(nameof(Index))); }
public void Delete(int id) { _flightService.Delete(id); }
public void Delete() { service.Delete(); }
public async Task <IActionResult> Delete(int id) { await _service.Delete(id); return(NoContent()); }
public IActionResult DeleteConfirm(int id) { flightService.Delete(id); return(Redirect("/Flight/All")); }