public async Task <ActionResult> EditAccommodation(int tripId, [FromBody] AccommodationEditDTO accommodationInfo) { try { if (!await _editRightsService.HasEditRights(tripId)) { return(BadRequest(new JsonResult("You can't currently edit this trip."))); } AccommodationDTO result = await _accommodationService.EditAccommodationInfo(accommodationInfo); await _editRightsService.ProlongEditRights(tripId, _redisAppSettings.EditRightsProlongedTTL); if (result != null) { return(Ok(result)); } return(BadRequest(new JsonResult("Accommodation dates are not valid."))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }