public async Task <IActionResult> Create(ProjectCreateGet Project) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var ProjectCreateGetWithErrorMessage = await _client.PostProtectedAsync <ProjectCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/Project/Create", Project, token); if (ProjectCreateGetWithErrorMessage.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/Project/Create", token); //ViewBag.Env = _hostingEnv.EnvironmentName; AllStuff.ErrorMessages = ProjectCreateGetWithErrorMessage.ErrorMessages; ViewBag.AllStuff = AllStuff; return(View(ProjectCreateGetWithErrorMessage.Project)); } return(RedirectToAction("Index")); }
public async Task <List <ErrorMessage> > CreatePostCheck(ProjectCreateGet Project) { string usp = "usp_ProjectCreatePostCheck @ProjectTypeId, @ParentProjectId, @StatusId, @SecurityLevelId, @Name, @Description, @MenuName, @MouseOver, @UserId"; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, Project); return(ErrorMessages); }
public async Task <string> CreatePost(ProjectCreateGet Project) { string usp = "usp_ProjectCreatePost @ProjectTypeId, @ParentProjectId, @StatusId, @SecurityLevelId, @Name, @Description, @MenuName, @MouseOver, @UserId"; var CheckString = await _sqlDataAccess.LoadSingleRecord <string, dynamic>(usp, Project); return(CheckString); }
public async Task <IActionResult> Create(ProjectCreateGet Project) { var CurrentUser = await _userManager.GetUserAsync(User); Project.UserId = CurrentUser.Id; if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString())) { var CheckString = await _projectProvider.CreatePostCheck(Project); if (CheckString.Count == 0) { _projectProvider.CreatePost(Project); return(Ok(Project)); } return(BadRequest(new { IsSuccess = false, Message = CheckString, //PETER TODO Not sure if the issue is here. But need to check if all is filled in well and then give feedback to front mvc })); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }
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 ProjectCreateGet = new ProjectCreateGet(); var Statuses = await _masterListProvider.StatusList(CurrentUser.Id); var ProjectTypes = await _projectTypeProvider.List(CurrentUser.Id); var UserLanguage = await _masterProvider.UserLanguageUpdateGet(CurrentUser.Id); var SecurityLevels = await _securityLevelProvider.List(CurrentUser.Id); ProjectCreateGet.LanguageId = UserLanguage.LanguageId; ProjectCreateGet.LanguageName = UserLanguage.Name; // ProjectCreateGet.ProjectTypes = ProjectTypes; ProjectCreateGet.Statuses = Statuses; ProjectCreateGet.SecurityLevels = SecurityLevels; if (Id == null) { Id = 0; } ProjectCreateGet.ParentProjectId = Id; return(Ok(ProjectCreateGet)); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }
public async Task <IActionResult> Create(ProjectCreateGet Project) { var CurrentUser = await _userManager.GetUserAsync(User); Project.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 _projectProvider.CreatePostCheck(Project); if (ErrorMessages.Count > 0) { Project = await CreateAddDropDownBoxes(Project, CurrentUser.Id); } else { _projectProvider.CreatePost(Project); } ProjectCreateGetWithErrorMessages ProjectWithErrorMessage = new ProjectCreateGetWithErrorMessages { Project = Project, ErrorMessages = ErrorMessages }; return(Ok(ProjectWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); ProjectCreateGetWithErrorMessages ProjectWithNoRights = new ProjectCreateGetWithErrorMessages { Project = Project, ErrorMessages = ErrorMessages }; return(Ok(ProjectWithNoRights)); }
public async Task <IActionResult> Create(ProjectCreateGet Project) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } await _client.PostProtectedAsync <ProjectCreateGet>($"{_configuration["APIUrl"]}api/FrontProject/Create", Project, token); return(RedirectToAction("AdvancedSearch")); }
public async Task <IActionResult> Create(int Id, [FromQuery(Name = "ParentProjectId")] int ParentProjectId = 0) { 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 Project = new ProjectCreateGet(); Project.ParentProjectId = ParentProjectId; Project.ProjectTypeId = Id; Project = await CreateAddDropDownBoxes(Project, CurrentUser.Id, ParentProjectId); return(Ok(Project)); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }
private async Task <ProjectCreateGet> CreateAddDropDownBoxes(ProjectCreateGet Project, string UserId, int ParentId = 0) { var Statuses = await _masterListProvider.StatusList(UserId); var UserLanguage = await _masterProvider.UserLanguageUpdateGet(UserId); var SecurityLevels = await _securityLevelProvider.List(UserId); Project.LanguageId = UserLanguage.LanguageId; Project.LanguageName = UserLanguage.Name; Project.Statuses = Statuses; Project.SecurityLevels = SecurityLevels; Project.CodeTypeId = await _projectTypeProvider.ReturnCodeTypeId(Project.ProjectTypeId); Project.ProjectTypeName = await _projectTypeProvider.ReturnName(UserId, Project.ProjectTypeId); Project.ParentProjectName = await _projectProvider.ReturnName(UserId, ParentId); return(Project); }