コード例 #1
0
 public ActionResult Update(Category model)
 {
     try
     {
         db.Entry(model).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     catch (Exception Ex)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest, Ex.Message);
     }
 }
コード例 #2
0
 public ActionResult Add(Category model)
 {
     try
     {
         db.Categories.Add(model);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     catch (Exception Ex)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest, Ex.Message);
     }
 }