public ActionResult Save(x_Planning plan) { if (x_PlanningRepo.Simpan(plan)) { return(Json(new { Simpan = "Berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { Simpan = "Gagal" }, JsonRequestBehavior.AllowGet)); } }
public static bool Simpan(x_Planning plan) { try { using (DataContext db = new DataContext()) { db.x_Planning.Add(plan); db.SaveChanges(); } return(true); } catch (Exception) { return(false); } }