public ActionResult AddOrEdit(Supplier supplier) { using (DemoEntities db = new DemoEntities()) { if (supplier.SupplierID == 0) { //db.Suppliers.Add(supplier); //db.SaveChanges(); db.AddNewSupplier(supplier.SupplierName, supplier.Telephone, supplier.Email); } else { db.Entry(supplier).State = EntityState.Modified; db.SaveChanges(); } } //return RedirectToAction("Index"); return(Json(new { success = true, html = Helper.GlobalClass.RenderRazorViewToString(this, "ViewAll", GetAllSuppliers()), message = "Submitted successfully!" }, JsonRequestBehavior.AllowGet)); }