public void Update(Bug bug) { var single = GetSingle(bug.BugId); single.BugName = bug.BugName; single.UserId = bug.UserId; single.UpdateTime = bug.UpdateTime; single.BugStatusId = bug.BugStatusId; single.Description = bug.Description; _bugTrackDbContext.SaveChanges(); }
public void Add(Bug bug) { _bugTrackDbContext.Bugs.Add(bug); _bugTrackDbContext.SaveChanges(); }
public ActionResult AddIssue([ModelBinder(typeof(JsonBinder<BugViewModel>))]BugViewModel bugViewModel) { var json = new JsonResult(); try { var bugStatus = _bugStatusLogic.Get(bugViewModel.BugStatusName,bugViewModel.ProjectId); if (bugStatus == null) { bugStatus = new BugStatus { BugStatusName = bugViewModel.BugStatusName, ProjectId = bugViewModel.ProjectId, Number = 0 }; _bugStatusLogic.Add(bugStatus); bugStatus = _bugStatusLogic.Get(bugViewModel.BugStatusName, bugViewModel.ProjectId); } var bug = new Bug { BugName = bugViewModel.BugName, Description = bugViewModel.Description, UserId = bugViewModel.AssignerId, BugStatusId = bugStatus.BugStatusId, CreateDate = DateTime.Now, UpdateTime = DateTime.Now, Sole = Guid.NewGuid() }; _bugLogic.Add(bug); var bugId = _bugLogic.Get(bug.BugName, bug.Sole).BugId; var userId = _cookieHelper.GetUserId(Request); var ioPath = Server.MapPath(Url.Content("~/Content/BugAttachments/")); var bugAttachmentsPath = ioPath + bugId; var tempPath = ioPath + userId + "_temp"; if (System.IO.Directory.Exists(tempPath)) { System.IO.Directory.Move(tempPath, bugAttachmentsPath); } json.Data = new { Status = true }; } catch { json.Data = new { Status = false }; } return json; }
public ActionResult EditIssue([ModelBinder(typeof(JsonBinder<BugViewModel>))]BugViewModel bugViewModel) { var json = new JsonResult(); try { var bugStatus = _bugStatusLogic.Get(bugViewModel.BugStatusName,bugViewModel.ProjectId); if (bugStatus == null) { bugStatus = new BugStatus { BugStatusName = bugViewModel.BugStatusName, ProjectId = bugViewModel.ProjectId, Number = 0 }; _bugStatusLogic.Add(bugStatus); bugStatus = _bugStatusLogic.Get(bugViewModel.BugStatusName, bugViewModel.ProjectId); } var bug=new Bug { BugId = bugViewModel.BugId, BugName = bugViewModel.BugName, Description = bugViewModel.Description, BugStatusId = bugStatus.BugStatusId, UpdateTime = DateTime.Now, UserId = bugViewModel.AssignerId }; _bugLogic.Update(bug); json.Data = new { Status = true }; } catch { json.Data = new { Status = false }; } return json; }
public void Update(Bug bug) { _bugRepository.Update(bug); }
public void Add(Bug bug) { _bugRepository.Add(bug); }