Exemplo n.º 1
0
        public bool UpdatePost(PropertyUpdateGet Property)
        {
            string usp = "usp_PropertyUpdatePost @PropertyId, @PropertyTypeId, @Name , @Description , @MenuName , @MouseOver , @UserId ";

            _sqlDataAccess.SaveData <PropertyUpdateGet>(usp, Property);
            return(true);
        }
Exemplo n.º 2
0
        public async Task <List <ErrorMessage> > UpdatePostCheck(PropertyUpdateGet Property)
        {
            string usp           = "usp_PropertyUpdatePostCheck @PropertyId, @PropertyTypeId, @Name , @Description , @MenuName , @MouseOver , @UserId ";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, Property);

            return(ErrorMessages);
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(PropertyUpdateGet Property)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var PropertyUpdateGetWithErrorMessage = await _client.PostProtectedAsync <PropertyUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/Property/Update", Property, token);

            if (PropertyUpdateGetWithErrorMessage.ErrorMessages.Count > 0)
            {
                ViewBag.Favorites = await _client.GetProtectedAsync <List <MVCFavoriteMenu> >($"{_configuration["APIUrl"]}api/MVCFavorite/Menu", token);

                ViewBag.FavoriteGroupList = await _client.GetProtectedAsync <List <MVCFavoriteGroupList> >($"{_configuration["APIUrl"]}api/MVCFavorite/GroupList", token);

                ViewBag.UITerms = await _client.GetProtectedAsync <List <UITermLanguageCustomizationList> >($"{_configuration["APIUrl"]}api/MVC/Property/Edit", token);

                ViewBag.Env = _hostingEnv.EnvironmentName;

                ViewBag.ErrorMessages = PropertyUpdateGetWithErrorMessage.ErrorMessages;
                return(View(PropertyUpdateGetWithErrorMessage.Property));
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 5
0
        private async Task <PropertyUpdateGet> UpdateAddDropDownBoxes(PropertyUpdateGet Property, string UserId)
        {
            Property.PropertyTypes = await _propertyTypeProvider.List(UserId);

            return(Property);
        }