public static Order GetOrder(string id) { using (var db = new OrderContext()) { return(AllOrders(db).FirstOrDefault(o => o.Id == id)); } }
private static IQueryable <Order> AllOrders(OrderContext db) { return(db.Orders.Include(o => o.Items.Select(i => i.GoodsItem)) .Include("Customer")); }
public static List <Order> GetAllOrders() { using (var db = new OrderContext()) { return(AllOrders(db).ToList()); } }
public static List <Goods> GetAll() { using (var db = new OrderContext()) { return(db.GoodItems.ToList()); } }