public ActionResult GetStoreName()
        {
            using (var db = new ProductSoldContext())
            {
                var StoreNameList = db.Stores.Select(x => new
                {
                    storeID   = x.Id,
                    storeName = x.Name,
                }).ToList();

                return(Json(StoreNameList, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult GetProductName()
        {
            using (var db = new ProductSoldContext())
            {
                var ProductNameList = db.Products.Select(x => new
                {
                    productID   = x.Id,
                    productName = x.Name,
                }).ToList();

                return(Json(ProductNameList, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult GetCustomerName()
        {
            using (var db = new ProductSoldContext())
            {
                var customerNameList = db.Customers.Select(x => new
                {
                    customerID   = x.Id,
                    customerName = x.Name,
                }).ToList();

                return(Json(customerNameList, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 4
0
 public ActionResult GetCustomerList()
 {
     using (var db = new ProductSoldContext())
     {
         var CustList = db.Customers.Select(x => new
         {
             CustomerID = x.Id,
             Name       = x.Name,
             Address    = x.Address
         }).ToList();
         return(Json(CustList, JsonRequestBehavior.AllowGet));
     }
 }
 public ActionResult GetProductSoldList()
 {
     using (var db = new ProductSoldContext())
     {
         var productSolds = db.ProductSolds.Include(p => p.Customer).Include(p => p.Product).Include(p => p.Store);
         var CustList     = db.ProductSolds.Select(x => new
         {
             ProductSoldID = x.Id,
             customerName  = x.Customer.Name,
             productName   = x.Product.Name,
             storeName     = x.Store.Name,
             dateSold      = x.DateSold
         }).ToList();
         return(Json(CustList, JsonRequestBehavior.AllowGet));
     }
 }