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 IHttpActionResult GetShop_sProduct(long id) { ShopProductsDTO shop = ShopProductsBLL.GetShopProductsById(id); if (shop == null) { return(NotFound()); } return(Ok(shop)); }
public static Shop_sProduct DTOToDAL(ShopProductsDTO shopProduct) { return(new Shop_sProduct { code = shopProduct.Code, productCode = shopProduct.productCode, shopCode = shopProduct.shopCode, price = shopProduct.price, duration = shopProduct.duration, status = shopProduct.status }); }
public IHttpActionResult PostShop_sProduct(ShopProductsDTO shop_sProduct) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //TimeSpan time = TimeSpan.Parse(shop_sProduct.duration.ToString()); ////string ts = TimeSpan.fromMinutes(this.prepareTime); //shop_sProduct.duration = time; ShopProductsDTO sRes = ShopProductsBLL.Add(shop_sProduct); return(Ok(sRes)); }