示例#1
0
        public ApiMessage <string> Del(PriceEx p)
        {
            var api = new ApiMessage <string>();

            if (string.IsNullOrEmpty(p.ID))
            {
                api.Success = false;
                api.Msg     = "该商品不存在价格";
                return(api);
            }
            var old = new oldprice();

            old.ID          = Guid.NewGuid().ToString();
            old.PriceID     = p.ID;
            old.ProductID   = p.ProductID;
            old.Price       = p.Price;
            old.MemberPrice = p.MemberPrice;
            old.LimitNum    = p.LimitNum;
            old.StaffName   = p.StaffName;
            old.ProductName = p.Name;
            old.CreatDate   = DateTime.Now;
            var msg = _dal.Del(old);

            api.Success = msg;
            api.Msg     = msg ? "操作成功" : "操作失败";
            return(api);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="px"></param>
        /// <returns></returns>
        public JsonResult Del(PriceEx px)
        {
            px.StaffID   = UserInfo.Id;
            px.StaffName = UserInfo.UserName;
            var res = _bll.Del(px);

            return(Json(res));
        }
示例#3
0
        public ApiMessage <string> Save(PriceEx n, CurrentUser user)
        {
            var res = new ApiMessage <string>();
            var p   = new productprice();

            p.ID          = n.ID;
            p.Price       = n.Price;
            p.MemberPrice = n.MemberPrice;
            p.LimitNum    = n.LimitNum;
            p.ProductID   = n.ProductID;
            p.UnitID      = n.UnitID;
            p.UnitName    = n.UnitID;
            p.StaffID     = user.Id;
            p.StaffName   = user.UserName;
            p.CreateDate  = DateTime.Now;
            _dal.Save(p);
            return(res);
        }
示例#4
0
        public void Convert_PriceEx_DTOToEntity_EntityToDTO()
        {
            const decimal outerPrice = 1.0M;

            var model = new PriceEx()
            {
                BasePrice = outerPrice
            };

            var pkMap          = new PrimaryKeyResolvingMap();
            var entityForPatch = (PriceExEntity)AbstractTypeFactory <PriceExEntity> .TryCreateInstance().FromModel(model, pkMap);

            var entity = AbstractTypeFactory <PriceExEntity> .TryCreateInstance();

            entityForPatch.Patch(entity);

            var modelResult = (PriceEx)entity.ToModel(AbstractTypeFactory <PriceEx> .TryCreateInstance());

            Assert.Equal(outerPrice, entityForPatch.BasePrice);
            Assert.Equal(outerPrice, entity.BasePrice);
            Assert.Equal(outerPrice, modelResult.BasePrice);
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public JsonResult Save(PriceEx model)
        {
            var res = _bll.Save(model, UserInfo);

            return(Json(res));
        }