public int AddOrUpdateCommodityCategory(AddOrUpdateCommodityCategoryDTO commodityCategory, string operatorName) { if (commodityCategory == null) { throw new ArgumentNullException("商品类别必须设定"); } if (string.IsNullOrWhiteSpace(operatorName)) { throw new ArgumentNullException("操作人必须设定"); } CRestaurantPO restaurant = CRestaurantManager.Instance.GetById(commodityCategory.ResId); if (restaurant == null) { throw new BusinessException("此餐厅不存在"); } CCommodityCategoryPO commodityCategoryPO = null; if (commodityCategory.Id > 0) { commodityCategoryPO = Instance.GetById(commodityCategory.Id); if (commodityCategoryPO == null) { throw new BusinessException("商品类别不存在"); } } else { commodityCategoryPO = new CCommodityCategoryPO(); } commodityCategoryPO.ChineseName = commodityCategory.ChineseName; commodityCategoryPO.EnglishName = commodityCategory.EnglishName; commodityCategoryPO.PicPath = commodityCategory.PicPath; commodityCategoryPO.Remark = commodityCategory.Remark; commodityCategoryPO.ResUUID = restaurant.ResUUID; commodityCategoryPO.Sort = commodityCategory.Sort; commodityCategoryPO.IsDelete = commodityCategory.IsDelete; if (commodityCategoryPO.Id > 0) { return(this.Update(commodityCategoryPO, operatorName)); } return(this.Add(commodityCategoryPO, operatorName)); }
/// <summary> /// 新增或者修改商品类别 /// </summary> /// <param name="commodityCategory"></param> /// <param name="operatorName"></param> /// <returns></returns> public ReturnValue <int> AddOrUpdateCommodityCategory(AddOrUpdateCommodityCategoryDTO commodityCategory, string operatorName) { return(ReturnValue <int> .Get200OK(CCommodityCategoryManager.Instance.AddOrUpdateCommodityCategory(commodityCategory, operatorName))); }