public List<wsItem> GetAllItems()
        {
            List<wsItem> items = new List<wsItem>();
            using(EasyShopDBContext db = new EasyShopDBContext())
            {
                foreach (Item item in db.Items)
                {
                    items.Add(new wsItem
                    {
                        Name = item.Name,
                        Price = item.Price.ToString(),
                        Id = item.Id.ToString()
                    });
                }

                return items;
            }
        }
Exemple #2
0
 private void MapItems(List<wsItem> items)
 {
     using(EasyShopDBContext db = new EasyShopDBContext())
     {
         foreach (wsItem item in items)
         {
            Item im = db.Items.First(i => i.Id == int.Parse(item.Id));
            locations[im.LocationId]++;
         }
     }
 }