コード例 #1
0
ファイル: TransformModel.cs プロジェクト: pear171902790/Bug
 public Project ToProjectFromCreateProjectViewModel(CreateProjectViewModel createProjectViewModel)
 {
     return new Project()
         {
             ProjectName = createProjectViewModel.ProjectName,
             Description = createProjectViewModel.Description,
             CreateDate = DateTime.Now
         };
 }
コード例 #2
0
 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");
     }
 }
コード例 #3
0
 public ActionResult CreateProject()
 {
     var userId = _cookieHelper.GetUserId(Request);
     var createProjectViewModel = new CreateProjectViewModel
     {
         CurrentUserName = _userLogic.Get(userId).UserName
     };
     return View(createProjectViewModel);
 }