Exemple #1
0
        public IActionResult GetById(long id)
        {
            var order = _orderRepository.Find(id);

            if (order == null)
            {
                return(NotFound());
            }


            return(new ObjectResult(order));
        }
        public async Task <IActionResult> GetOrderItem([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var orderItem = await _orderItems.Find(id);

            if (orderItem == null)
            {
                return(NotFound());
            }

            return(Ok(orderItem));
        }
Exemple #3
0
 public ActionResult ChangeStoreItem(IEnumerable <OrderItemViewModel> items, string orderNo)
 {
     if (!ModelState.IsValid)
     {
         foreach (var item in items)
         {
             item.ProductResource = new ResourceViewModel().FromEntity <ResourceViewModel>(_orderRepo.Context.Set <ResourceEntity>().Where(r => r.SourceType == (int)SourceType.Product && r.SourceId == item.ProductId).FirstOrDefault());
         }
         ViewBag.OrderNo = orderNo;
         return(View(items));
     }
     using (var ts = new TransactionScope())
     {
         foreach (var item in items)
         {
             var itemEntity = _orderItemRepo.Find(item.Id);
             itemEntity.StoreItemNo   = item.StoreItemNo;
             itemEntity.StoreItemDesc = item.StoreItemDesc;
             itemEntity.UpdateDate    = DateTime.Now;
             itemEntity.UpdateUser    = CurrentUser.CustomerId;
             _orderItemRepo.Update(itemEntity);
         }
         var orderEntity = _orderRepo.Find(orderNo);
         orderEntity.Status     = (int)OrderStatus.AgentConfirmed;
         orderEntity.UpdateDate = DateTime.Now;
         orderEntity.UpdateUser = CurrentUser.CustomerId;
         _orderRepo.Update(orderEntity);
         _orderLogRepo.Insert(new OrderLogEntity()
         {
             OrderNo    = orderNo,
             CreateDate = DateTime.Now,
             CreateUser = CurrentUser.CustomerId,
             CustomerId = CurrentUser.CustomerId,
             Operation  = "专柜确认商品编码。",
             Type       = (int)OrderOpera.FromOperator
         });
         ts.Complete();
     }
     return(View("Details", new { OrderNo = orderNo }));
 }