// /// <summary> /// constructor that add product to DB /// </summary> /// <param name="price"></param> /// <param name="description"></param> /// <param name="shopId"></param> /// <param name="orderId"></param> /// <param name="shopProductCode"></param> /// <param name="imageUrl"></param> public BLProduct(double price, string description, int shopId, int shopProductCode, string imageUrl) { Id = ProductDal.AddProduct(price, description, shopId, shopProductCode, imageUrl); Price = price; Description = description; ShopID = shopId; ShopProductCode = shopProductCode; ImageUrl = imageUrl; }
/// <summary> /// add product by row and shop id /// </summary> /// <param name="row"></param> /// <param name="shopId"></param> /// <returns></returns> public static BLProduct AddProductByDataRow(DataRow row, int shopId) { double Price = double.Parse(row["Price"].ToString()); string Description = row["Description"].ToString(); int ShopProductCode = int.Parse(row["ShopProductCode"].ToString()); string ImageUrl = row["Image"].ToString(); int Id = ProductDal.AddProduct(Price, Description, shopId, ShopProductCode, ImageUrl); return(new BLProduct(Id, Price, Description, shopId, ShopProductCode, ImageUrl)); }
public ActionResult Create(products pro) //FormCollection collection { try { ProductDal pd = new ProductDal(); pd.AddProduct(pro); return(RedirectToAction("Index")); } catch { return(View()); } }
public async Task <IHttpActionResult> AddProduct([FromBody] ProductModel model) { bool success = false; if (model == null) { return(BadRequest("Please provide the product")); } try { Product product = _mapper.Map <Product>(model); success = await ProductDal.AddProduct(product); } catch (Exception ex) { success = false; } return(Ok(success)); }
/// <summary> /// 添加产品 /// </summary> /// <param name="pro"></param> /// <returns></returns> public static int AddProduct(Product pro) { return(ProductDal.AddProduct(pro)); }
public bool AddProduct(T_Protuct model) { ProductDal productdal = new ProductDal(); return(productdal.AddProduct(model)); }
public bool Add(Product model) { return(_infoDal.AddProduct(model) > 0); }