Example #1
0
 public void Update(Project project)
 {
     var single = Get(project.ProjectId);
     single.ProjectName = project.ProjectName;
     single.Description = project.Description;
     _bugTrackDbContext.SaveChanges();
 }
Example #2
0
 public SettingsViewModel ToSettingsViewModelFromProject(Project project)
 {
     return new SettingsViewModel()
         {
             ProjectName = project.ProjectName,
             Description = project.Description,
             ProjectId = project.ProjectId
         };
 }
Example #3
0
 public void Update(Project project)
 {
     _projectRepository.Update(project);
 }
Example #4
0
 public void CreateProject(Project project)
 {
     _projectRepository.Add(project);
 }
Example #5
0
 public void Add(Project project)
 {
     _bugTrackDbContext.Projects.Add(project);
     _bugTrackDbContext.SaveChanges();
 }
Example #6
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");
     }
 }
Example #7
0
        public ActionResult Update([ModelBinder(typeof(JsonBinder<SettingsViewModel>))]SettingsViewModel settingsViewModel)
        {
            var jsonResult = new JsonResult();
            try
            {
                var project = new Project
                    {
                        ProjectId = settingsViewModel.ProjectId,
                        ProjectName = settingsViewModel.ProjectName,
                        Description = settingsViewModel.Description
                    };
                _projectLogic.Update(project);

                jsonResult.Data = new { IsSuccess = true };
            }
            catch (Exception)
            {
                jsonResult.Data = new { IsSuccess = false };
            }
            return jsonResult;
        }