public ActionResult createProject() { EntrepreneurAuth cred = check_clientRelation(); if (!cred.Valid) { Redirect("/User/Index"); // kick out of entrepreneur control to the user control. } manageClient_Sessions(cred); Models.EntrepreneurCreateProjectViewModel entrepreneurAccount = new Models.EntrepreneurCreateProjectViewModel(cred.Entrepreneur_ID, User.Identity.GetUserId()); return(View(entrepreneurAccount)); }
public ActionResult createProject(Models.EntrepreneurCreateProjectViewModel newProject) { EntrepreneurAuth cred = check_clientRelation(); if (!cred.Valid) { Redirect("/User/Index"); // kick out of entrepreneur control to the user control. } Models.EntrepreneurCreateProjectViewModel authenticated_newProject = new Models.EntrepreneurCreateProjectViewModel(cred.Entrepreneur_ID, User.Identity.GetUserId()); authenticated_newProject.Name = newProject.Name; authenticated_newProject.Description = newProject.Description; authenticated_newProject.Investment_Goal = newProject.Investment_Goal; int newPRoject_Id = authenticated_newProject.createProject(); if (newPRoject_Id == 0) { // TODO: return error to client user on page. ModelState.AddModelError("", "Project account not created."); return(View(newProject)); } return(Redirect(string.Format("/Project/Index/{0}", newPRoject_Id))); }