コード例 #1
0
 public ActionResult Edit(Maintenance maintenance)
 {
     if (ModelState.IsValid)
     {
         db.Entry(maintenance).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(maintenance);
 }
コード例 #2
0
        public ActionResult Create(Maintenance maintenance)
        {
            if (ModelState.IsValid)
            {
                db.Maintenances.Add(maintenance);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(maintenance);
        }