Example #1
0
        public async Task <IActionResult> Edit([FromBody] TravelPlanDto travelPlanDto)
        {
            try
            {
                var userId = HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier).Value;
                var editedTravelPlanDto = await _travelPlanService.EditAsync(travelPlanDto, new Guid(userId));

                return(Ok(editedTravelPlanDto));
            }
            catch (InsufficientRightsException insufRights)
            {
                return(BadRequest(new
                {
                    Message = insufRights.Message
                }));
            }
            catch (Exception exc)
            {
                return(BadRequest());
            }
        }