Пример #1
0
        public async Task <ActionResult> TimelineDelete([FromRoute][TimelineName] string timeline)
        {
            try
            {
                var timelineId = await _service.GetTimelineIdByNameAsync(timeline);

                if (!UserHasAllTimelineManagementPermission && !(await _service.HasManagePermissionAsync(timelineId, GetUserId())))
                {
                    return(ForbidWithCommonResponse());
                }

                await _service.DeleteTimelineAsync(timelineId);

                return(DeleteWithCommonDeleteResponse());
            }
            catch (EntityNotExistException)
            {
                if (UserHasAllTimelineManagementPermission)
                {
                    return(DeleteWithCommonDeleteResponse(false));
                }
                else
                {
                    return(ForbidWithCommonResponse());
                }
            }
        }