コード例 #1
0
        public ActionResult Create(Project project)
        {
            if (ModelState.IsValid)
            {
                db.Projects.Add(project);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.BranchId = new SelectList(db.Branches, "Id", "Description", project.BranchId);
            return View(project);
        }
コード例 #2
0
 public ActionResult Edit(Project project)
 {
     if (ModelState.IsValid)
     {
         db.Entry(project).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.BranchId = new SelectList(db.Branches, "Id", "Description", project.BranchId);
     return View(project);
 }