예제 #1
0
 public ActionResult Create(Phone phone)
 {
     if (ModelState.IsValid)
     {
         db.Phones.Add(phone);
         db.SaveChanges();
         return(Json(new { success = true }));
     }
     return(PartialView("Create", phone));
 }
예제 #2
0
 public JsonResult Create(Phone phone)
 {
     if (ModelState.IsValid)
     {
         db.Phones.Add(phone);
         db.SaveChanges();
         return(Json(new { success = true }));
     }
     return(Json(phone, JsonRequestBehavior.AllowGet));
 }