/// <summary> /// 设置商品基本信息控件 /// </summary> /// <param name="goodsId"></param> /// <returns></returns> public IActionResult _SetGoodsInfo(long goodsId) { GoodsInfo info = goodsInfoService.GetGoodsInfo(goodsId); SetGoodsInfoModel model = new SetGoodsInfoModel(); model = model.ToSetGoodsInfoModel(info); GoodsCategoryLevel2 level2 = goodsCategoryLevelService.GetCategoryLevel2(model.CategoryLevel2Id); if (level2 != null) { model.CategoryLevel2Name = level2.CategoryName; } else { model.CategoryLevel2Name = string.Empty; } return(View(model)); }
/// <summary> /// 设置商品基本信息 /// </summary> /// <param name="goodsId"></param> /// <returns></returns> public IActionResult SetGoodsInfo(SetGoodsInfoModel model) { if (model == null || model.Goodsid <= 0) { return(Json(new StatusMessageData(StatusMessageType.Error, "数据不正确!"))); } StatusMessageData statusMessageData = null; GoodsInfo info = goodsInfoService.GetGoodsInfo(model.Goodsid); info = model.AsGoodsInfo(info); SetGoodsInfoStatus status = SetGoodsInfoStatus.UnknownFailure; goodsInfoService.SetGoodsInfo(info, out status); switch (status) { case SetGoodsInfoStatus.UnknownFailure: statusMessageData = new StatusMessageData(StatusMessageType.Success, "发生未知错误!"); break; case SetGoodsInfoStatus.DataCatch: statusMessageData = new StatusMessageData(StatusMessageType.Success, "数据发生异常!"); break; default: break; } if (statusMessageData == null) { return(Json(new StatusMessageData(StatusMessageType.Success, "设置成功!"))); } else { return(Json(statusMessageData)); } }