public async Task <IActionResult> Update(ClassificationLevelUpdateGet ClassificationLevel) { var CurrentUser = await _userManager.GetUserAsync(User); ClassificationLevel.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 _classificationLevelProvider.UpdatePostCheck(ClassificationLevel); if (ErrorMessages.Count > 0) { ClassificationLevel = await UpdateAddDropDownBoxes(ClassificationLevel, CurrentUser.Id); } else { _classificationLevelProvider.UpdatePost(ClassificationLevel); } ClassificationLevelUpdateGetWithErrorMessages ClassificationLevelWithErrorMessage = new ClassificationLevelUpdateGetWithErrorMessages { ClassificationLevel = ClassificationLevel, ErrorMessages = ErrorMessages }; return(Ok(ClassificationLevelWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); ClassificationLevelUpdateGetWithErrorMessages ClassificationLevelWithNoRights = new ClassificationLevelUpdateGetWithErrorMessages { ClassificationLevel = ClassificationLevel, ErrorMessages = ErrorMessages }; return(Ok(ClassificationLevelWithNoRights)); }
public bool UpdatePost(ClassificationLevelUpdateGet ClassificationLevel) { string usp = "usp_classificationLevelUpdatePost @ClassificationLevelId,@CodePrefix , @CodeSuffix , @CodeTypeId , @Sequence, @DateLevelId, @OnTheFly, @Alphabetically, @CanLink, @InDropDown, @InMenu, @Name, @Description, @MenuName, @MouseOver, @UserID"; _sqlDataAccess.SaveData <ClassificationLevelUpdateGet>(usp, ClassificationLevel); return(true); }
public async Task <IActionResult> Edit(ClassificationLevelUpdateGet ClassificationLevel) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var ClassificationLevelUpdateGetWithErrorMessage = await _client.PostProtectedAsync <ClassificationLevelUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/ClassificationLevel/Update", ClassificationLevel, token); if (ClassificationLevelUpdateGetWithErrorMessage.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 = ClassificationLevelUpdateGetWithErrorMessage.ErrorMessages; ViewBag.AllStuff = AllStuff; //ViewBag.UITerms = await _client.GetProtectedAsync<List<UITermLanguageCustomizationList>>($"{_configuration["APIUrl"]}api/MVC/ClassificationLevel/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 = ClassificationLevelUpdateGetWithErrorMessage.ErrorMessages; //ViewBag.Env = _hostingEnv.EnvironmentName; return(View(ClassificationLevelUpdateGetWithErrorMessage.ClassificationLevel)); } return(RedirectToAction("Index", new { id = ClassificationLevel.ClassificationId })); }
public async Task <List <ErrorMessage> > UpdatePostCheck(ClassificationLevelUpdateGet ClassificationLevel) { string usp = "usp_ClassificationLevelUpdatePostCheck @ClassificationLevelId, @CodePrefix , @CodeSuffix , @CodeTypeId ,@Sequence, @DateLevelId, @OnTheFly, @Alphabetically, @CanLink, @InDropDown, @InMenu, @Name, @Description, @MenuName, @MouseOver, @UserID"; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, ClassificationLevel); return(ErrorMessages); }
private async Task <ClassificationLevelUpdateGet> UpdateAddDropDownBoxes(ClassificationLevelUpdateGet ClassificationLevel, string UserId) { ClassificationLevel.DateLevels = await _dateLevelProvider.List(UserId); ClassificationLevel.Sequences = await _classificationLevelProvider.CreateGetSequence(UserId, ClassificationLevel.ClassificationId); ClassificationLevel.CodeTypes = await _codeTypeProvider.List(UserId); return(ClassificationLevel); }