public ActionResult Create(Issue issue) { if (ModelState.IsValid) { issue.IssueId = Guid.NewGuid(); db.Issues.Add(issue); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.IssuePriorityId = new SelectList(db.IssuePriorities, "Id", "Name", issue.IssuePriorityId); ViewBag.IssueResolutionId = new SelectList(db.IssueResolutions, "Id", "Name", issue.IssueResolutionId); ViewBag.IssueTypeId = new SelectList(db.IssueTypes, "Id", "Name", issue.IssueTypeId); ViewBag.ProjectId = new SelectList(db.Projects, "Id", "Name", issue.ProjectId); return View(issue); }
public ActionResult Edit(Issue issue) { if (ModelState.IsValid) { db.Entry(issue).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.IssuePriorityId = new SelectList(db.IssuePriorities, "Id", "Name", issue.IssuePriorityId); ViewBag.IssueResolutionId = new SelectList(db.IssueResolutions, "Id", "Name", issue.IssueResolutionId); ViewBag.IssueTypeId = new SelectList(db.IssueTypes, "Id", "Name", issue.IssueTypeId); ViewBag.ProjectId = new SelectList(db.Projects, "Id", "Name", issue.ProjectId); return View(issue); }