public async Task <ItemDataContract> GetItemByIdAsync(int itemId) { GetShopDBData dbRepository = new GetShopDBData(); ItemDataContract itemDataContract = new ItemDataContract(); itemDataContract = dbRepository.GetItemById(itemId); return(itemDataContract); }
//public bool InsertOrUpdateItem(Item item) //{ // context.ItemSet.Add(item); // return true; //} //public List<Shop> GetShops() //{ // List<Shop> shops = new List<Shop>(); // try // { // shops = context.ShopSet.ToList(); // } // catch (Exception ex) // { // throw ex; // } // return shops; //} //public async Task<List<Shop>> GetShopsAsync() //{ // return await context.ShopSet.ToListAsync(); //} //public bool InsertOrUpdateShop(Shop shop) //{ // context.ShopSet.Add(shop); // return true; //} //public List<Price> GetPrices() //{ // return context.PriceSet.ToList(); //} public List <PriceDataContract> GetPricesByItem(int?itemId) { GetShopDBData dbRepository = new GetShopDBData(); List <PriceDataContract> prices = new List <PriceDataContract>(); try { prices = dbRepository.GetPricesByItem(itemId); } catch (Exception ex) { throw ex; } return(prices); //context.PriceSet.Where(x => x.ItemId == itemId).ToList(); }
public ShopDataContract UpdateShop(ShopDataContract shopDataContract) { GetShopDBData dBRepository = new GetShopDBData(); bool retVal = false; try { retVal = dBRepository.UpdateShop(shopDataContract); } catch (Exception ex) { throw ex; } return(shopDataContract); }
public List <ShopDataContract> GetShops() { GetShopDBData dBRepository = new GetShopDBData(); List <ShopDataContract> shops = new List <ShopDataContract>(); try { shops = dBRepository.GetShops(); } catch (Exception ex) { throw ex; } return(shops); }
//BeforeBuyingContainer context = null; //public DBRepository2() //{ // context = new BeforeBuyingContainer(); //} public async Task <List <ItemDataContract> > GetAllItemsAsync(/*int id*/) { GetShopDBData dbRepository = new GetShopDBData(); List <ItemDataContract> items = new List <ItemDataContract>(); try { items = dbRepository.getItems(); } catch (Exception ex) { throw ex; } return(items); // context.ItemSet.ToListAsync(); //return context.ItemSet.Select(x => x).ToList(); }