public JsonResult Update(ProductSold psold)
 {
     using (ProductSoldEntities dbobj = new ProductSoldEntities())
     {
         dbobj.Entry(psold).State = EntityState.Modified;
         dbobj.SaveChanges();
         return(Json(dbobj.SaveChanges(), JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 2
0
        public JsonResult AddProduct(ProductView p)
        {
            var product = new Product {
                PId = p.PId, ProductName = p.ProductName, ProductPrice = p.ProductPrice
            };

            dbobj.Products.Add(product);
            return(Json(dbobj.SaveChanges(), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public JsonResult AddProductSold(ProductSoldView ps)
        {
            var productdsold = new ProductSold {
                CustomerId = ps.CustomerId, ProductId = ps.ProductId, StoreId = ps.StoreId
            };

            dbobj.ProductSolds.Add(productdsold);
            dbobj.SaveChanges();

            return(Json(dbobj.SaveChanges(), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public ActionResult AddCustomer(CustomerView cus)
        {
            var c = new Customer {
                CId = cus.CId, CustomerAddress = cus.CustomerAddress, CustomerName = cus.CustomerName
            };

            dbobj.Customers.Add(c);
            dbobj.SaveChanges();

            return(Json(c, JsonRequestBehavior.AllowGet));
            //return Json(new { Success = true });
        }
Exemplo n.º 5
0
        public JsonResult AddStore(StoreView s)
        {
            var store = new Store
            {
                SId          = s.SId,
                StoreName    = s.StoreName,
                StoreAddress = s.StoreAddress
            };

            dbobj.Stores.Add(store);
            return(Json(dbobj.SaveChanges(), JsonRequestBehavior.AllowGet));
        }
 public JsonResult UpdateStore(Store s)
 {
     using (ProductSoldEntities dbobj = new ProductSoldEntities())
     {
         dbobj.Entry(s).State = EntityState.Modified;
         dbobj.SaveChanges();
         return(Json(new { success = true, message = "saved" }, JsonRequestBehavior.AllowGet));
     }
 }
 public ActionResult AddStore(Store s)
 {
     using (ProductSoldEntities dbobj = new ProductSoldEntities())
     {
         dbobj.Stores.Add(s);
         dbobj.SaveChanges();
         return(RedirectToAction("GetStore"));
     }
 }
 public JsonResult RemoveProduct(int ID)
 {
     using (ProductSoldEntities dbobj = new ProductSoldEntities())
     {
         ProductSold psold = dbobj.ProductSolds.Find(ID);
         dbobj.ProductSolds.Remove(psold);
         return(Json(dbobj.SaveChanges(), JsonRequestBehavior.AllowGet));
     }
 }
        // to add
        public JsonResult Add(ProductSold psold)
        {
            using (ProductSoldEntities dbobj = new ProductSoldEntities())
            {
                dbobj.ProductSolds.Add(psold);

                return(Json(dbobj.SaveChanges(), JsonRequestBehavior.AllowGet));
            }
        }
 public ActionResult AddCustomer(Customer c)
 {
     using (ProductSoldEntities dbobj = new ProductSoldEntities())
     {
         dbobj.Customers.Add(c);
         dbobj.SaveChanges();
         return(RedirectToAction("GetCustomer"));
     }
 }
 public ActionResult AddProduct(Product p)
 {
     using (ProductSoldEntities dbobj = new ProductSoldEntities())
     {
         dbobj.Products.Add(p);
         dbobj.SaveChanges();
         return(RedirectToAction("GetProduct"));
     }
 }
 public ActionResult DeleteStore(int id)
 {
     using (ProductSoldEntities dbobj = new ProductSoldEntities())
     {
         var store = dbobj.Stores.Where(x => x.SId == id).FirstOrDefault();
         dbobj.Stores.Remove(store);
         dbobj.SaveChanges();
         return(Json(new { success = true, message = "deleted" }, JsonRequestBehavior.AllowGet));
     }
 }