Exemplo n.º 1
0
        public bool UpdatePost(BaseLanguageUpdateGet BaseLanguage)
        {
            string usp = "usp_BaseLanguageUpdatePost @BaseType, @BaseLanguageId, @Name , @Description , @MenuName , @MouseOver, @UserId ";

            _sqlDataAccess.SaveData <BaseLanguageUpdateGet>(usp, BaseLanguage);
            return(true);
        } //PETER TODO In the stored procedure the check on hasdropdown is not yet ok.
Exemplo n.º 2
0
        public async Task <IActionResult> LanguageEdit(BaseLanguageUpdateGet BaseLanguage)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var BaseLanguageUpdateGetWithErrorMessage = await _client.PostProtectedAsync <BaseLanguageUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/Base/LanguageUpdate?BaseType={BaseLanguage.BaseType}", BaseLanguage, token);

            if (BaseLanguageUpdateGetWithErrorMessage.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 = BaseLanguageUpdateGetWithErrorMessage.ErrorMessages;
                ViewBag.AllStuff       = AllStuff;

                //ViewBag.AllStuff = await _loadViewBagModel.ViewBagLoad(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), token, _hostingEnv.EnvironmentName, _configuration, false, 0, "");
                //ViewBag.UITerms = await _client.GetProtectedAsync<List<UITermLanguageCustomizationList>>($"{_configuration["APIUrl"]}api/MVC/{BaseLanguage.BaseType}/LanguageEdit", token);
                //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.ErrorMessages = BaseLanguageUpdateGetWithErrorMessage.ErrorMessages;
                //ViewBag.Env = _hostingEnv.EnvironmentName;
                return(View(BaseLanguageUpdateGetWithErrorMessage.BaseLanguage));
            }
            var RouteValues = new Dictionary <string, string> {
                { "BaseType", BaseLanguage.BaseType }, { "Id", BaseLanguage.BaseId.ToString() }
            };

            return(RedirectToAction("LanguageIndex", "Base", RouteValues));
        }
Exemplo n.º 3
0
        public async Task <List <ErrorMessage> > UpdatePostCheck(BaseLanguageUpdateGet BaseLanguage)
        {
            string usp           = "usp_BaseLanguageUpdatePostCheck @BaseType, @BaseLanguageId, @Name , @Description , @MenuName , @MouseOver, @UserId ";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, BaseLanguage);

            return(ErrorMessages);
        }
Exemplo n.º 4
0
        private async Task <BaseLanguageUpdateGet> UpdateAddDropDownBoxes(BaseLanguageUpdateGet BaseLanguage, string UserId)
        {
            var LanguageList = await _baseProvider.CreateGetLanguages(BaseLanguage.BaseLanguageId, BaseLanguage.BaseType, UserId);

            BaseLanguage.Languages = LanguageList;
            var BaseTableName = await _baseProvider.BaseTypeToTable(BaseLanguage.BaseType);

            BaseLanguage.UITermTitle = await _iUITermLanguageCustomizationProvider.TableNameToOneTerm(BaseTableName, UserId, false, "", "");

            var UITerm = await _iUITermLanguageCustomizationProvider.OneTerm(BaseLanguage.BaseType, UserId);

            return(BaseLanguage);
        }
Exemplo n.º 5
0
        public async Task <IActionResult> LanguageUpdate(BaseLanguageUpdateGet BaseLanguage)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            BaseLanguage.UserId = CurrentUser.Id;
            var ErrorMessages = new List <ErrorMessage>();

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

                if (ErrorMessages.Count > 0)
                {
                    BaseLanguage = await UpdateAddDropDownBoxes(BaseLanguage, CurrentUser.Id);
                }
                else
                {
                    _baseProvider.UpdatePost(BaseLanguage);
                }
                BaseLanguageUpdateGetWithErrorMessages BaseLanguageWithErrorMessage
                    = new BaseLanguageUpdateGetWithErrorMessages {
                    BaseLanguage = BaseLanguage, ErrorMessages = ErrorMessages
                    };
                return(Ok(BaseLanguageWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            BaseLanguageUpdateGetWithErrorMessages BaseLanguageWithNoRights = new BaseLanguageUpdateGetWithErrorMessages {
                BaseLanguage = BaseLanguage, ErrorMessages = ErrorMessages
            };

            return(Ok(BaseLanguageWithNoRights));
        }