コード例 #1
0
        public ActionResult Create(Issue issue, string companyId = null)
        {
            if (ModelState.IsValid)
            {
                if (companyId != null)
                    issue.Companies.Add(db.Companies.Find(companyId));
                db.Issues.Add(issue);
                db.SaveChanges();

                return RedirectToAction("Index");
            }

            return View(issue);
        }
コード例 #2
0
        //
        // GET: /Issue/Create
        public ActionResult Create(int? companyId = null, bool wizard = false)
        {
            if (companyId != null)
            {
                Company owner = db.Companies.Where(c => c.Id == companyId).FirstOrDefault();
                ViewBag.CompanyId = companyId;
            }

            Issue newIssue = new Issue
            {
                Opened = DateTime.Now,
                State = IssueState.OPEN
            };
            db.Issues.Add(newIssue);
            db.SaveChanges();
            ViewBag.Wizard = wizard;
            return View("Edit", newIssue);
        }
コード例 #3
0
 public ActionResult Edit(Issue issue, bool wizard = false)
 {
     if (ModelState.IsValid)
     {
         db.Entry(issue).State = EntityState.Modified;
         db.SaveChanges();
         if (wizard)
             return RedirectToAction("Create", "Call", new { issueId = issue.Id });
         return RedirectToAction("Index");
     }
     return View(issue);
 }