public async Task <IActionResult> UpdateFlight(AddFlightVM vm) { var depDate = vm.DepartDate.Value; var depTime = vm.DepartTime.Value; var arrDate = vm.ArrDate.Value; var arrTime = vm.ArrTime.Value; vm.Flight.DepartDateTime = new DateTime(depDate.Year, depDate.Month, depDate.Day, depTime.Hour, depTime.Minute, depTime.Second); vm.Flight.ArrDateTime = new DateTime(arrDate.Year, arrDate.Month, arrDate.Day, arrTime.Hour, arrTime.Minute, arrTime.Second); var returnId = await _flightRepo.UpdateFlight(vm.Flight); return(RedirectToAction(nameof(ViewAllFlights))); }
public async Task <IActionResult> UpdateFlightDetails(int id, Flights flightDetails) { if (id != flightDetails.Flightid) { return(BadRequest()); } try { //_log4net.Info("update tacos with id " + id + "method is invoked"); await repo.UpdateFlight(id, flightDetails); } catch (Exception) { return(BadRequest("Update Flight details failed!")); } return(NoContent()); }