Пример #1
0
        public async Task <ActionResult> AddUserToTrip(int tripId, int memberId)
        {
            try
            {
                if (!await _editRightsService.HasEditRights(tripId))
                {
                    return(BadRequest(new JsonResult("You can't currently edit this trip.")));
                }
                TripDTO trip = await _tripService.AddMemberToTrip(tripId, memberId, false);

                await _editRightsService.ProlongEditRights(tripId, _redisAppSettings.EditRightsProlongedTTL);

                if (trip != null)
                {
                    return(Ok(trip));
                }
                return(BadRequest());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }