public async Task <List <ErrorMessage> > UpdatePostCheck(MVCFavoriteUpdateGet Favorite)
        {
            string usp           = "usp_FrontUserFavoriteUpdatePostCheck @MVCFavoriteId, @Sequence, @Name, @Description, @MenuName, @MouseOver, @UserId";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, Favorite);

            return(ErrorMessages);
        }
Пример #2
0
        public async Task <IActionResult> Update(MVCFavoriteUpdateGet MVCFavorite)
        {
            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 _frontUserFavoriteProvider.UpdatePostCheck(MVCFavorite);

                if (ErrorMessages.Count > 0)
                {
                    MVCFavorite = await UpdateAddDropDownBoxes(MVCFavorite, CurrentUser.Id);
                }
                else
                {
                    _frontUserFavoriteProvider.UpdatePost(MVCFavorite);
                }
                MVCFavoriteUpdateGetWithErrorMessages MVCFavoriteWithErrorMessage = new MVCFavoriteUpdateGetWithErrorMessages {
                    MVCFavorite = MVCFavorite, ErrorMessages = ErrorMessages
                };
                return(Ok(MVCFavoriteWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            MVCFavoriteUpdateGetWithErrorMessages MVCFavoriteWithNoRights = new MVCFavoriteUpdateGetWithErrorMessages {
                MVCFavorite = MVCFavorite, ErrorMessages = ErrorMessages
            };

            return(Ok(MVCFavoriteWithNoRights));
        }
        public async Task <bool> UpdatePost(MVCFavoriteUpdateGet Favorite)
        {
            string usp = "usp_FrontUserFavoriteUpdatePost @MVCFavoriteId, @Sequence, @Name, @Description, @MenuName, @MouseOver, @UserId";

            _sqlDataAccess.SaveData <dynamic>(usp, Favorite);
            return(true);
        }
Пример #4
0
        private async Task <MVCFavoriteUpdateGet> UpdateAddDropDownBoxes(MVCFavoriteUpdateGet MVCFavorite, string UserId)
        {
            var Sequences = await _frontUserFavoriteProvider.UpdateGetSequence(UserId, MVCFavorite.MVCFavoriteGroupId);

            var MVCFavoriteGroups = await _frontUserFavoriteGroupProvider.List(UserId);

            MVCFavorite.Sequences         = Sequences;
            MVCFavorite.MVCFavoriteGroups = MVCFavoriteGroups;
            return(MVCFavorite);
        }
Пример #5
0
        public async Task <IActionResult> Edit(MVCFavoriteUpdateGet MVCFavorite)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var MVCFavoriteUpdateGetWithErrorMessage = await _client.PostProtectedAsync <MVCFavoriteUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/FrontUserFavorite/Update", MVCFavorite, token);

            if (MVCFavoriteUpdateGetWithErrorMessage.ErrorMessages.Count > 0)
            {
                var AllStuff = await _loadViewBagModel.ViewBagLoad(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), token, _hostingEnv.EnvironmentName, _configuration, false, 0, "");

                AllStuff.ErrorMessages = MVCFavoriteUpdateGetWithErrorMessage.ErrorMessages;
                ViewBag.AllStuff       = AllStuff;
                //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/FrontUserFavorite/Edit", token);
                //ViewBag.Env = _hostingEnv.EnvironmentName;

                //ViewBag.ErrorMessages = MVCFavoriteUpdateGetWithErrorMessage.ErrorMessages;
                return(View(MVCFavoriteUpdateGetWithErrorMessage.MVCFavorite));
            }
            return(RedirectToAction("Index"));
        }