public async Task <IActionResult> Create(ProjectTypeCreateGet ProjectType) { var CurrentUser = await _userManager.GetUserAsync(User); ProjectType.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 _projectTypeProvider.CreatePostCheck(ProjectType); if (ErrorMessages.Count > 0) { ProjectType = await CreateAddDropDownBoxes(ProjectType, CurrentUser.Id); } else { _projectTypeProvider.CreatePost(ProjectType); } ProjectTypeCreateGetWithErrorMessages ProjectTypeWithErrorMessage = new ProjectTypeCreateGetWithErrorMessages { ProjectType = ProjectType, ErrorMessages = ErrorMessages }; return(Ok(ProjectTypeWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); ProjectTypeCreateGetWithErrorMessages ProjectTypeWithNoRights = new ProjectTypeCreateGetWithErrorMessages { ProjectType = ProjectType, ErrorMessages = ErrorMessages }; return(Ok(ProjectTypeWithNoRights)); }
public async Task <IActionResult> Create(ProjectTypeCreateGet ProjectType) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var ProjectTypeCreateGetWithErrorMessage = await _client.PostProtectedAsync <ProjectTypeCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/ProjectType/Create", ProjectType, token); if (ProjectTypeCreateGetWithErrorMessage.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, ""); //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/ProjectType/Create", token); //ViewBag.Env = _hostingEnv.EnvironmentName; AllStuff.ErrorMessages = ProjectTypeCreateGetWithErrorMessage.ErrorMessages; ViewBag.AllStuff = AllStuff; return(View(ProjectTypeCreateGetWithErrorMessage.ProjectType)); } return(RedirectToAction("Index")); }
public async Task <string> CreatePost(ProjectTypeCreateGet ProjectType) { string usp = "usp_ProjectTypeCreatePost @Name, @Description , @MenuName , @MouseOver , @CodePrefix , @CodeSuffix , @CodeTypeId ,@HasAnyChildProject, @HasAnyMatrixProject, @Color , @IconID , @UserId "; var String = await _sqlDataAccess.LoadSingleRecord <string, dynamic>(usp, ProjectType); return(String); }
public async Task <List <ErrorMessage> > CreatePostCheck(ProjectTypeCreateGet ProjectType) { string usp = "usp_ProjectTypeCreatePostCheck @Name, @Description , @MenuName , @MouseOver , @CodePrefix , @CodeSuffix , @CodeTypeId , @HasAnyChildProject, @HasAnyMatrixProject, @Color , @IconID , @UserId "; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, ProjectType); return(ErrorMessages); }
private async Task <ProjectTypeCreateGet> CreateAddDropDownBoxes(ProjectTypeCreateGet ProjectType, string UserId) { var icons = await _masterListProvider.IconList(UserId); ProjectType.CodeTypes = await _codeTypeProvider.List(UserId); ProjectType.Icons = icons; return(ProjectType); }
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 ProjectType = new ProjectTypeCreateGet(); ProjectType = await CreateAddDropDownBoxes(ProjectType, CurrentUser.Id); return(Ok(ProjectType)); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }