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

                if (ErrorMessages.Count > 0)
                {
                    Property = await UpdateAddDropDownBoxes(Property, CurrentUser.Id);
                }
                else
                {
                    _propertyProvider.UpdatePost(Property);
                }
                PropertyUpdateGetWithErrorMessages PropertyWithErrorMessage = new PropertyUpdateGetWithErrorMessages {
                    Property = Property, ErrorMessages = ErrorMessages
                };
                return(Ok(PropertyWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            PropertyUpdateGetWithErrorMessages PropertyWithNoRights = new PropertyUpdateGetWithErrorMessages {
                Property = Property, ErrorMessages = ErrorMessages
            };

            return(Ok(PropertyWithNoRights));
        }