/// <summary> /// 设置商品基本信息 /// </summary> /// <param name="entity"></param> /// <param name="status"></param> public void SetGoodsInfo(GoodsInfo entity, out SetGoodsInfoStatus status) { status = SetGoodsInfoStatus.UnknownFailure; if (entity == null || entity.Goodsid > 0) { status = SetGoodsInfoStatus.DataCatch; } var result = goodsInfoRepository.UpdateCache(entity, new { goods_name = entity.GoodsName, category_level2_id = entity.CategoryLevel2Id, subject_title = entity.SubjectTitle, buy_count = entity.BuyCount, real_buy_count = entity.RealBuyCount, place_origin = entity.PlaceOrigin, freight = entity.Freight, stock = entity.Stock, status = entity.Status, is_enable = entity.IsEnable, is_visible = entity.IsVisible, limit_purchase_count = entity.LimitPurchaseCount, display_order = entity.DisplayOrder, is_hot = entity.IsHot, goods_price = entity.GoodsPrice, goods_real_price = entity.GoodsRealPrice }, w => w.Goodsid == entity.Goodsid); if (result) { status = SetGoodsInfoStatus.Success; } }
/// <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)); } }