Пример #1
0
        public async Task <IActionResult> Update(PersonUpdateGet Person)
        {
            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 _personProvider.UpdatePostCheck(Person);

                if (ErrorMessages.Count > 0)
                {
                    Person = await UpdateAddDropDownBoxes(Person, CurrentUser.Id);
                }
                else
                {
                    _personProvider.UpdatePost(Person);
                }
                PersonUpdateGetWithErrorMessages PersonWithErrorMessage = new PersonUpdateGetWithErrorMessages {
                    Person = Person, ErrorMessages = ErrorMessages
                };
                return(Ok(PersonWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            PersonUpdateGetWithErrorMessages PersonWithNoRights = new PersonUpdateGetWithErrorMessages {
                Person = Person, ErrorMessages = ErrorMessages
            };

            return(Ok(PersonWithNoRights));
        }