public bool CreatePost(ClassificationRoleCreateGet ClassificationRole) { string usp = "usp_ClassificationRoleCreatePost @RoleId, @ClassificationId, @ClassificationRelationTypeId, @UserID"; _sqlDataAccess.SaveData <ClassificationRoleCreateGet>(usp, ClassificationRole); return(true); }
public async Task <List <ErrorMessage> > CreatePostCheck(ClassificationRoleCreateGet ClassificationRole) { string usp = "usp_ClassificationRoleCreatePostCheck @RoleId, @ClassificationId , @ClassificationRelationTypeId, CreatorId"; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, ClassificationRole); return(ErrorMessages); }
public async Task <IActionResult> Create(ClassificationRoleCreateGet ClassificationRole) { var CurrentUser = await _userManager.GetUserAsync(User); ClassificationRole.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 _classificationRoleProvider.CreatePostCheck(ClassificationRole); if (ErrorMessages.Count > 0) { ClassificationRole = await CreateAddDropDownBoxes(ClassificationRole, CurrentUser.Id); } else { _classificationRoleProvider.CreatePost(ClassificationRole); } ClassificationRoleCreateGetWithErrorMessages ClassificationRoleWithErrorMessage = new ClassificationRoleCreateGetWithErrorMessages { ClassificationRole = ClassificationRole, ErrorMessages = ErrorMessages }; return(Ok(ClassificationRoleWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); ClassificationRoleCreateGetWithErrorMessages ClassificationRoleWithNoRights = new ClassificationRoleCreateGetWithErrorMessages { ClassificationRole = ClassificationRole, ErrorMessages = ErrorMessages }; return(Ok(ClassificationRoleWithNoRights)); }
private async Task <ClassificationRoleCreateGet> CreateAddDropDownBoxes(ClassificationRoleCreateGet ClassificationRole, string UserId) { var ClassificationRelationTypes = await _classificationRelationTypeProvider.List(UserId); ClassificationRole.ClassificationRelationTypes = ClassificationRelationTypes; ClassificationRole.Roles = await _roleProvider.List(UserId); return(ClassificationRole); }
public async Task <IActionResult> Create(int Id) { var CurrentUser = await _userManager.GetUserAsync(User); if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString())) { var ClassificationRole = new ClassificationRoleCreateGet(); ClassificationRole = await CreateAddDropDownBoxes(ClassificationRole, CurrentUser.Id); ClassificationRole.ClassificationId = Id; return(Ok(ClassificationRole)); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }
public async Task <IActionResult> Create(ClassificationRoleCreateGet ClassificationRole) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var ClassificationRoleCreateGetWithErrorMessage = await _client.PostProtectedAsync <ClassificationRoleCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/ClassificationRole/Create", ClassificationRole, token); if (ClassificationRoleCreateGetWithErrorMessage.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 = ClassificationRoleCreateGetWithErrorMessage.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/ClassificationRole/Create", token); //ViewBag.Env = _hostingEnv.EnvironmentName; //ViewBag.ErrorMessages = ClassificationRoleCreateGetWithErrorMessage.ErrorMessages; return(View(ClassificationRoleCreateGetWithErrorMessage.ClassificationRole)); } return(RedirectToAction("Index", new { id = ClassificationRole.ClassificationId })); }