public Project ToProjectFromCreateProjectViewModel(CreateProjectViewModel createProjectViewModel) { return new Project() { ProjectName = createProjectViewModel.ProjectName, Description = createProjectViewModel.Description, CreateDate = DateTime.Now }; }
public ActionResult CreateProject(CreateProjectViewModel createProjectViewModel) { try { var project = new Project { ProjectName = createProjectViewModel.ProjectName, Description = createProjectViewModel.Description, CreateDate = DateTime.Now, Sole = Guid.NewGuid() }; var userId = _cookieHelper.GetUserId(Request); _projectLogic.CreateProject(project); var projectId = _projectLogic.Get(project.ProjectName,project.Sole).ProjectId; var userProjectRoleRelation=new UserProjectRoleRelation { ProjectId = projectId, UserId = userId, RoleId = RoleConfig.Creator }; _userProjectRoleRelationLogic.Add(userProjectRoleRelation); return new RedirectResult(Url.Action("Index", "Project")); } catch { return View("Error"); } }
public ActionResult CreateProject() { var userId = _cookieHelper.GetUserId(Request); var createProjectViewModel = new CreateProjectViewModel { CurrentUserName = _userLogic.Get(userId).UserName }; return View(createProjectViewModel); }