public static List <ShopProductsDTO> GetAllShopProducts() { using (GetCoffeeDBEntities db = new GetCoffeeDBEntities()) { return(ShopProductsConverter.DALListToDTO(db.Shop_sProduct.ToList())); } }
public static List <ShopProductsDTO> GetShopProductsById(long id) { using (GetCoffeeDBEntities db = new GetCoffeeDBEntities()) { return(ShopProductsConverter.DALsToDTOs(db.Shop_sProduct.Where(Shop => Shop.shopCode == id).ToList())); } }
public static ShopProductsDTO GetShopProductsById(long id) { using (GetCoffeeDBEntities db = new GetCoffeeDBEntities()) { return(ShopProductsConverter.DALToDTO(db.Shop_sProduct.Find(id))); } }
public static ShopProductsDTO Add(ShopProductsDTO shopProducts) { Shop_sProduct ss = ShopProductsConverter.DTOToDAL(shopProducts); using (GetCoffeeDBEntities db = new GetCoffeeDBEntities()) { db.Shop_sProduct.Add(ss); db.SaveChanges(); } return(ShopProductsConverter.DALToDTO(ss)); }
public static void updateShopProducts(List <ShopProductsDTO> shop_sProducts) { using (GetCoffeeDBEntities db = new GetCoffeeDBEntities()) { List <Shop_sProduct> products = ShopProductsConverter.DTOsToDALs(shop_sProducts); products.ForEach(item => { db.Entry(item).State = EntityState.Modified; }); db.SaveChanges(); } }