Exemplo n.º 1
0
        public async Task <ActionResult> Edit(string id)
        {
            var manager  = new SpotGoodsManager(User);
            var spotGood = await manager.GetSpotGoods(id);

            var spotGoodViewModel = Mapper.Map <SpotGoods, SpotGoodsViewModel>(spotGood);

            return(View("Create", spotGoodViewModel));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Detail(string id)
        {
            Requires.NotNullOrEmpty("id", nameof(id));

            var manager   = new SpotGoodsManager(User);
            var spotGoods = await manager.GetSpotGoods(id);

            var spotGoodViewModel = Mapper.Map <SpotGoods, SpotGoodsViewModel>(spotGoods);

            return(View(spotGoodViewModel));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> UpdateLockStatus(string orderId, bool isLock)
        {
            var manager   = new SpotGoodsManager();
            var spotGoods = await manager.GetSpotGoods(orderId);

            if (spotGoods == null)
            {
                return(NotFound("商品不存在"));
            }

            if (spotGoods.Status != SpotGoodsStatus.New)
            {
                return(NotFound("商品已出售"));
            }

            if (spotGoods.IsLock && isLock)
            {
                return(NotFound("商品已锁定"));
            }

            var result = await manager.UpdateSpotGoodLock(orderId, isLock);

            return(Ok(result));
        }