public async Task <ResponseModel> AddGoods(Goods goods) { ResponseModel result = new ResponseModel(); result.Code = 1; await goodsService.AddGoods(goods); return(result); }
public ResultModel addGoods([FromBody] Goods goods) { ResultModel res = new ResultModel(); if (GoodsService.AddGoods(goods)) { res.status = "200"; res.insert("ID", goods.ID); } else { res.status = "500"; } return(res); }
public ActionResult AddGoods1(ViewModelGoods goods, ViewModelVersions version) { Goods saveGoods = new Goods { GoodsId = goods.GoodsId, GoodsName = goods.GoodsName, Type = goods.Type, Detail = goods.Detail, Configuration = goods.Configuration, InstallWay = goods.InstallWay, }; //保存版本图片 Versions saveVersions = new Versions { GoodsId = goods.GoodsId, VersionName = version.VersionName, Price = version.Price, VersionId = version.VersionId, Stock = version.Stock, VersionImage = GetImageFromWeb(), ActivationTimes = version.ActivationTimes, Sell = version.Sell, WarehouseId = version.WarehouseId, }; if (goodsService.AddGoods(saveGoods, saveVersions)) { return(PartialView("GoodsList")); } else { TempData["Error"] = "请填写必填项!!!"; return(PartialView("AddGoods1", new ViewModelGoods { GoodsId = goods.GoodsId })); } }