コード例 #1
0
        public async Task <IActionResult> Edit(ProjectTypeMatrixUpdateGet ProjectTypeMatrix)
        {
            var token = HttpContext.Session.GetString("Token");

            if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var ProjectTypeMatrixUpdateGetWithErrorMessage = await _client.PostProtectedAsync <ProjectTypeMatrixUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/ProjectTypeMatrix/Update", ProjectTypeMatrix, token);

            if (ProjectTypeMatrixUpdateGetWithErrorMessage.ErrorMessages.Count > 0)
            {
                ViewBag.UITerms = await _client.GetProtectedAsync <List <UITermLanguageCustomizationList> >($"{_configuration["APIUrl"]}api/MVC/ProjectTypeMatrix/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 = ProjectTypeMatrixUpdateGetWithErrorMessage.ErrorMessages;
                ViewBag.Env           = _hostingEnv.EnvironmentName;
                return(View(ProjectTypeMatrixUpdateGetWithErrorMessage.ProjectTypeMatrix));
            }
            if (ProjectTypeMatrix.IsFrom)
            {
                return(RedirectToAction("Index", new { id = ProjectTypeMatrix.FromProjectTypeId }));
            }
            else
            {
                return(RedirectToAction("Index", new { id = ProjectTypeMatrix.ToProjectTypeId }));
            }
        }
コード例 #2
0
        public bool UpdatePost(ProjectTypeMatrixUpdateGet ProjectTypeMatrix)
        {
            string usp = "usp_ProjectTypeMatrixUpdatePost @ProjectTypeMatrixId , @FromProjectTypeId , @ToProjectTypeId , @ProjectMatrixTypeId , @Name , @Description , @MenuName , @MouseOver , @IsFrom , @UserId ";

            _sqlDataAccess.SaveData <ProjectTypeMatrixUpdateGet>(usp, ProjectTypeMatrix);
            return(true);
        }
コード例 #3
0
        public async Task <List <ErrorMessage> > UpdatePostCheck(ProjectTypeMatrixUpdateGet ProjectTypeMatrix)
        {
            string usp           = "usp_ProjectTypeMatrixUpdatePostCheck @ProjectTypeMatrixId , @FromProjectTypeId , @ToProjectTypeId , @ProjectMatrixTypeId , @Name , @Description , @MenuName , @MouseOver , @IsFrom , @UserId ";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, ProjectTypeMatrix);

            return(ErrorMessages);
        }
コード例 #4
0
        public async Task <IActionResult> Update(ProjectTypeMatrixUpdateGet ProjectTypeMatrix)
        {
            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 _projectTypeMatrixProvider.UpdatePostCheck(ProjectTypeMatrix);

                if (ErrorMessages.Count > 0)
                {
                    ProjectTypeMatrix = await UpdateAddDropDownBoxes(ProjectTypeMatrix, CurrentUser.Id);
                }
                else
                {
                    _projectTypeMatrixProvider.UpdatePost(ProjectTypeMatrix);
                }
                ProjectTypeMatrixUpdateGetWithErrorMessages ProjectTypeMatrixWithErrorMessage = new ProjectTypeMatrixUpdateGetWithErrorMessages {
                    ProjectTypeMatrix = ProjectTypeMatrix, ErrorMessages = ErrorMessages
                };
                return(Ok(ProjectTypeMatrixWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ProjectTypeMatrixUpdateGetWithErrorMessages ProjectTypeMatrixWithNoRights = new ProjectTypeMatrixUpdateGetWithErrorMessages {
                ProjectTypeMatrix = ProjectTypeMatrix, ErrorMessages = ErrorMessages
            };

            return(Ok(ProjectTypeMatrixWithNoRights));
        }
コード例 #5
0
        private async Task <ProjectTypeMatrixUpdateGet> UpdateAddDropDownBoxes(ProjectTypeMatrixUpdateGet ProjectTypeMatrix, string UserId)
        {
            ProjectTypeMatrix.ProjectTypes = await _projectTypeProvider.List(UserId);

            ProjectTypeMatrix.ProjectMatrixTypes = await _projectMatrixTypeProvider.List(UserId);

            return(ProjectTypeMatrix);
        }