Example #1
0
        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
            });
        }
Example #2
0
        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
            });
        }
Example #3
0
        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
            });
        }