public async Task <IActionResult> Add(int goodsId, int shopId, decimal price) { var res = new ResultModel(); var isAdd = await _context.GoodsPrices.AnyAsync(p => p.ShopId == shopId && p.GoodsId == goodsId); if (isAdd) { res.Code = 0; res.Message = "店铺价格已存在,请勿重复添加"; return(Json(res)); } var entity = new GoodsPrice { ShopId = shopId, Price = price, GoodsId = goodsId, IsDelete = false }; _context.Add(entity); await _context.SaveChangesAsync(); res.Code = 100; res.Message = "新增成功"; return(Json(res)); }
private void UDForm4_Load(object sender, EventArgs e) { this.checkBox1.Checked = Order.IsComplete; this.bindingSource1.DataSource = Order.OrderItems; foreach (string item in GoodsPrice.GetList().Keys) { this.comboBox1.Items.Add(item); } }
/// <summary> /// 添加商品表的数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddPrice(GoodsPrice model) { string proName = "Pro_Price"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter { ParameterName = "@Id", DbType = DbType.Guid, Direction = ParameterDirection.Input, Value = model.Id }, new SqlParameter { ParameterName = "@JinHPrice", DbType = DbType.Decimal, Direction = ParameterDirection.Input, Value = model.JinHPrice }, }; return(_db.ExecuteNonQueryProc(proName, parameters)); }
public int AddPrice(GoodsPrice m) { string procName = "AddPrice"; SqlParameter[] param = new SqlParameter[] { new SqlParameter { ParameterName = "@Id", DbType = DbType.Guid, Direction = ParameterDirection.Input, Value = m.Id }, new SqlParameter { ParameterName = "@JinHPrice", DbType = DbType.Decimal, Direction = ParameterDirection.Input, Value = m.JinHPrice } }; return(dBHelper.ExecuteNonQueryProc(procName, param)); }
public async Task <IActionResult> Create([Bind("Id,BrandId,GoodsImg,GoodsCode,GoodsName,GoodsSepc,GoodsUnit,AddTime")] Goods goods, decimal price = 0) { if (ModelState.IsValid) { goods.Status = 1; goods.IsDelete = false; goods.AddTime = DateTime.Now; _context.Add(goods); await _context.SaveChangesAsync(); if (price > 0) { GoodsPrice goodsPrice = new GoodsPrice(); goodsPrice.GoodsId = goods.Id; goodsPrice.Price = price; goodsPrice.ShopId = 0; _context.Add(goodsPrice); await _context.SaveChangesAsync(); } return(RedirectToAction(nameof(Index))); } return(View(goods)); }
public int AddPrice([FromForm] GoodsPrice m) { return(_bll.AddPrice(m)); }
/// <summary> /// 添加商品表的数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddPrice(GoodsPrice model) { return(_dal.AddPrice(model)); }
public int UpdatePrice([FromForm] GoodsPrice m) { return(goodsBLL.UpdatePrice(m)); }
public int AddPrice([FromForm] GoodsPrice m) { return(goodsBLL.AddPrice(m)); }