Example #1
0
        public async Task <bool> UpdatePost(ProjectMatrixTypeUpdateGet ProjectMatrixType)
        {
            string usp = "usp_ProjectMatrixTypeUpdatePost @ProjectMatrixTypeId, @Name , @Description , @MenuName , @MouseOver , @UserId ";
            await _sqlDataAccess.SaveData <ProjectMatrixTypeUpdateGet>(usp, ProjectMatrixType);

            return(true);
        } //PETER TODO In the stored procedure the check on hasdropdown is not yet ok.
        public async Task <IActionResult> Update(ProjectMatrixTypeUpdateGet ProjectMatrixType)
        {
            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()))
            {
                ProjectMatrixType.UserId = CurrentUser.Id;
                ErrorMessages            = await _projectMatrixTypeProvider.UpdatePostCheck(ProjectMatrixType);

                if (ErrorMessages.Count > 0)
                {
                }
                else
                {
                    _projectMatrixTypeProvider.UpdatePost(ProjectMatrixType);
                }
                ProjectMatrixTypeUpdateGetWithErrorMessages ProjectMatrixTypeWithErrorMessage = new ProjectMatrixTypeUpdateGetWithErrorMessages {
                    ProjectMatrixType = ProjectMatrixType, ErrorMessages = ErrorMessages
                };
                return(Ok(ProjectMatrixTypeWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ProjectMatrixTypeUpdateGetWithErrorMessages ProjectMatrixTypeWithNoRights = new ProjectMatrixTypeUpdateGetWithErrorMessages {
                ProjectMatrixType = ProjectMatrixType, ErrorMessages = ErrorMessages
            };

            return(Ok(ProjectMatrixTypeWithNoRights));
        }
Example #3
0
        public async Task <List <ErrorMessage> > UpdatePostCheck(ProjectMatrixTypeUpdateGet ProjectMatrixType)
        {
            string usp           = "usp_ProjectMatrixTypeUpdatePostCheck @ProjectMatrixTypeId, @Name , @Description , @MenuName , @MouseOver , @UserId ";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, ProjectMatrixType);

            return(ErrorMessages);
        }
Example #4
0
        public async Task <IActionResult> Edit(ProjectMatrixTypeUpdateGet ProjectMatrixType)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var ProjectMatrixTypeUpdateGetWithErrorMessage = await _client.PostProtectedAsync <ProjectMatrixTypeUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/ProjectMatrixType/Update", ProjectMatrixType, token);

            if (ProjectMatrixTypeUpdateGetWithErrorMessage.ErrorMessages.Count > 0)
            {
                ViewBag.UITerms = await _client.GetProtectedAsync <List <UITermLanguageCustomizationList> >($"{_configuration["APIUrl"]}api/MVC/ProjectMatrixType/Edit", 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 = ProjectMatrixTypeUpdateGetWithErrorMessage.ErrorMessages;
                ViewBag.Env           = _hostingEnv.EnvironmentName;
                return(View(ProjectMatrixTypeUpdateGetWithErrorMessage.ProjectMatrixType));
            }
            return(RedirectToAction("Index"));
        }