public async Task <Response <FlightBasicDTO> > UpdaateStatus(FlightStatusUpdateDTO flightStatusUpdateDTO) { var userIDResponse = _userService.GetCurrentUserID(); if (!userIDResponse.Success) { return(new Response <FlightBasicDTO>(userIDResponse)); } var flight = _flightRepository.UpdateStatusAsync(flightStatusUpdateDTO.Target, flightStatusUpdateDTO.Status); return(await Response <FlightBasicDTO> .CatchInvalidOperationExceptionAndMap(flight, _mapper)); }
public async Task <SpecificObjectResult <FlightBasicDTO> > UpdateStatus([FromBody] FlightStatusUpdateDTO flightStatusUpdateDTO) { if (!ModelState.IsValid) { return(new SpecificObjectResult <FlightBasicDTO>(BadRequest(INVALID_MODEL_MESSAGE_STRING))); } var response = await _flightService.UpdaateStatus(flightStatusUpdateDTO); if (response.Success) { return(new SpecificObjectResult <FlightBasicDTO>(response.Value)); } return(new SpecificObjectResult <FlightBasicDTO>(BadRequest(response.Message))); }