コード例 #1
0
        public async Task <IActionResult> Delete([FromQuery] string id)
        {
            try
            {
                var userId       = HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier).Value;
                var isSuccessful = await _travelPlanService.DeleteAsync(new Guid(id), new Guid(userId));

                if (!isSuccessful)
                {
                    return(StatusCode(500));
                }

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