public JsonResult DeleteSales(int?id) { Sale Sale = db.Sales.Find(id); db.Sales.Remove(Sale); db.SaveChanges(); return(new JsonResult { Data = "Deleted", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult DeleteCustomer(int?Id) { Customer Customer = db.Customers.Find(Id); db.Customers.Remove(Customer); db.SaveChanges(); return(new JsonResult { Data = "Deleted", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult CreateProduct(Product pro) { db.Products.Add(pro); try { db.SaveChanges(); } catch (Exception error) { return(new JsonResult { Data = error, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } return(new JsonResult { Data = "Added", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }