Пример #1
0
        public IMessageProvider Save()
        {
            if (string.IsNullOrWhiteSpace(commodityNo))
            {
                AddError(1, "请输入商品编码");
                return(this);
            }
            var commdity = CommodityService.GetBycommodityNo(commodityNo);

            if (commdity == null)
            {
                AddError(1, "商品编码不存在");
                return(this);
            }
            var model = SecondKillCommoditysService.GetById(Id);

            if (model != null)
            {
                model.commodityId = commdity.commodityId;
                model.num         = num;
                model.price       = price;
                model.surplusNum  = num - model.payNum;
                model.commodityNo = commodityNo;
                SecondKillCommoditysService.Update(model);
            }
            AddMessage("success");
            return(this);
        }