public async Task CreateProdAsync(StockRuleProdDTO input) { using (var context = new O2OContext()) { var service = new BaseService <StockRuleProdEntity>(context); var entity = ToolsCommon.EntityToEntity(input, new StockRuleProdEntity()) as StockRuleProdEntity; service.Add(entity); } }
public async Task <ActionResult> ProdCreate(StockRuleProdDTO input) { //判断商品是否存在 var dto = await _stockRuleService.GetProdAsync(input.StockRuleId, input.ProdNo); if (dto != null) { return(Json(new AjaxResult() { state = "err", msg = "商品已经存在" })); } await _stockRuleService.CreateProdAsync(input); return(Json(new AjaxResult() { state = "ok" })); }