Esempio n. 1
0
        public async Task <IActionResult> Update(ContentTypeUpdateGet ContentType)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            var ErrorMessages = new List <ErrorMessage>();

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                ErrorMessages = await _contentTypeProvider.UpdatePostCheck(ContentType);

                if (ErrorMessages.Count > 0)
                {
                    ContentType = await UpdateAddDropDownBoxes(ContentType, CurrentUser.Id);
                }
                else
                {
                    ContentType.UserId = CurrentUser.Id;
                    _contentTypeProvider.UpdatePost(ContentType);
                }
                ContentTypeUpdateGetWithErrorMessages ContentTypeWithErrorMessage = new ContentTypeUpdateGetWithErrorMessages {
                    ContentType = ContentType, ErrorMessages = ErrorMessages
                };
                return(Ok(ContentTypeWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ContentTypeUpdateGetWithErrorMessages ContentTypeWithNoRights = new ContentTypeUpdateGetWithErrorMessages {
                ContentType = ContentType, ErrorMessages = ErrorMessages
            };

            return(Ok(ContentTypeWithNoRights));
        }