public async Task <IActionResult> Edit(ProjectUpdateGet Project) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var ProjectUpdateGetWithErrorMessage = await _client.PostProtectedAsync <ProjectUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/FrontProject/Update", Project, token); if (ProjectUpdateGetWithErrorMessage.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 = ProjectUpdateGetWithErrorMessage.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/FrontProject/Edit", token); //ViewBag.Env = _hostingEnv.EnvironmentName; //ViewBag.ErrorMessages = ProjectUpdateGetWithErrorMessage.ErrorMessages; return(View(ProjectUpdateGetWithErrorMessage.Project)); } return(RedirectToAction("Index")); }
public bool UpdatePost(ProjectUpdateGet Project) { string usp = "usp_ProjectUpdatePost @ProjectId, @ProjectTypeId, @StatusId, @SecurityLevelId, @Name, @Description, @MenuName, @MouseOver, @UserId"; _sqlDataAccess.SaveData <ProjectUpdateGet>(usp, Project); return(true); }
public async Task <IActionResult> Update(ProjectUpdateGet Project) { 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 _projectProvider.UpdatePostCheck(Project); if (ErrorMessages.Count > 0) { Project = await UpdateAddDropDownBoxes(Project, CurrentUser.Id); } else { _projectProvider.UpdatePost(Project); } ProjectUpdateGetWithErrorMessages ProjectWithErrorMessage = new ProjectUpdateGetWithErrorMessages { Project = Project, ErrorMessages = ErrorMessages }; return(Ok(ProjectWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); ProjectUpdateGetWithErrorMessages ProjectWithNoRights = new ProjectUpdateGetWithErrorMessages { Project = Project, ErrorMessages = ErrorMessages }; return(Ok(ProjectWithNoRights)); }
public async Task <List <ErrorMessage> > UpdatePostCheck(ProjectUpdateGet Project) { string usp = "usp_ProjectUpdatePostCheck @ProjectId, @ProjectTypeId, @StatusId, @SecurityLevelId, @Name, @Description, @MenuName, @MouseOver, @UserId"; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, Project); return(ErrorMessages); }
private async Task <ProjectUpdateGet> UpdateAddDropDownBoxes(ProjectUpdateGet Project, string UserId) { var Statuses = await _masterListProvider.StatusList(UserId); var ProjectTypes = await _projectTypeProvider.List(UserId); var UserLanguage = await _masterProvider.UserLanguageUpdateGet(UserId); var SecurityLevels = await _securityLevelProvider.List(UserId); // Project.ProjectTypes = ProjectTypes; Project.Statuses = Statuses; Project.SecurityLevels = SecurityLevels; return(Project); }