public List<Customer> GetCustomers() { ZhenLiuOnlineDBContext customers = new ZhenLiuOnlineDBContext(); var customerList = customers.Customers.ToList(); return customerList; }
public List<Product> GetProducts() { ZhenLiuOnlineDBContext products = new ZhenLiuOnlineDBContext(); var productList = products.Products.ToList(); return productList; }
public Customer GetCustomerById(int customerID) { ZhenLiuOnlineDBContext customers = new ZhenLiuOnlineDBContext(); Customer customer = customers.Customers.Single(cus => cus.CustomerId == customerID); return customer; }
public JsonResult moveToSpecial(List<int> data) { var db = new ZhenLiuOnlineDBContext(); var listOfOrders = db.Products.Where(x => data.Contains(x.Id)).ToList().Select(o => new ProductViewModel { Id = o.Id, Name = o.Name, Price = o.Price.ToString(), Url = o.Url, OnSpecial = true, OutOfStock = false }).ToList(); return Json(listOfOrders, JsonRequestBehavior.AllowGet); }