示例#1
0
 public List <StatusModel> GetStatuses()
 {
     using (OrderListContext db = new OrderListContext())
     {
         return(db.Statuses.Select(s => new StatusModel {
             Id = s.Id, Name = s.Name
         }).ToList());
     }
 }
示例#2
0
 public List <ProductModel> GetProducts()
 {
     using (OrderListContext db = new OrderListContext())
     {
         return(db.Products.Select(p =>
                                   new ProductModel {
             Id = p.Id, Name = p.Name, Price = p.Price, PhotoUrl = p.PhotoUrl
         }).ToList());
     }
 }