Exemplo n.º 1
0
        public async Task <IActionResult> Create(UserMenuTemplateCreateGet UserMenuTemplate)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var UserMenuTemplateCreateGetWithErrorMessage = await _client.PostProtectedAsync <UserMenuTemplateCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/UserMenuTemplate/Create", UserMenuTemplate, token);

            if (UserMenuTemplateCreateGetWithErrorMessage.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/UserMenuTemplate/Create", token);

                ViewBag.Env = _hostingEnv.EnvironmentName;

                ViewBag.ErrorMessages = UserMenuTemplateCreateGetWithErrorMessage.ErrorMessages;
                return(View(UserMenuTemplateCreateGetWithErrorMessage.UserMenuTemplate));
            }


            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Create(UserMenuTemplateCreateGet UserMenuTemplate)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            UserMenuTemplate.UserId = CurrentUser.Id;
            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 _userMenuTemplateProvider.CreatePostCheck(UserMenuTemplate);

                if (ErrorMessages.Count > 0)
                {
                    UserMenuTemplate = await CreateAddDropDownBoxes(UserMenuTemplate, CurrentUser.Id);
                }
                else
                {
                    _userMenuTemplateProvider.CreatePost(UserMenuTemplate);
                }
                UserMenuTemplateCreateGetWithErrorMessages UserMenuTemplateWithErrorMessage = new UserMenuTemplateCreateGetWithErrorMessages {
                    UserMenuTemplate = UserMenuTemplate, ErrorMessages = ErrorMessages
                };
                return(Ok(UserMenuTemplateWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            UserMenuTemplateCreateGetWithErrorMessages UserMenuTemplateWithNoRights = new UserMenuTemplateCreateGetWithErrorMessages {
                UserMenuTemplate = UserMenuTemplate, ErrorMessages = ErrorMessages
            };

            return(Ok(UserMenuTemplateWithNoRights));
        }
Exemplo n.º 3
0
        public async Task <List <ErrorMessage> > CreatePostCheck(UserMenuTemplateCreateGet UserMenuTemplate)
        {
            string usp           = "usp_UserMenuTemplateCreatePostCheck @Name, @Description, @MenuName, @MouseOver, @CreatorID";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, UserMenuTemplate);

            return(ErrorMessages);
        }
Exemplo n.º 4
0
        public bool CreatePost(UserMenuTemplateCreateGet UserMenuTemplate)
        {
            string usp = "usp_UserMenuTemplateCreatePost @Name, @Description, @MenuName, @MouseOver, @CreatorID";

            _sqlDataAccess.SaveData <UserMenuTemplateCreateGet>(usp, UserMenuTemplate);
            return(true);
        }
 private async Task <UserMenuTemplateCreateGet> CreateAddDropDownBoxes(UserMenuTemplateCreateGet UserMenuTemplate, string UserId)
 {
     return(UserMenuTemplate);
 }