예제 #1
0
        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);
        }
예제 #2
0
 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);
 }