Example #1
0
        // GET: Orders/Details/5
        public ActionResult Details(int id)
        {
            Order order = orderRepo.Get(id);

            if (order == null)
            {
                return(HttpNotFound());
            }
            return(View(order));
        }
Example #2
0
        public IActionResult Index()
        {
            _logger.LogInfo($"Zapytanie do metody Index()");

            DisplayErrorFromRedirectIfNecessary();

            var result = _orderRepo.Get();

            if (result.IsSuccess)
            {
                var model = Map <IEnumerable <OrderViewModel> >(result.Value);
                return(View(model));
            }
            else
            {
                AddLocalError(result.FailureMessage);
                return(View(Enumerable.Empty <OrderViewModel>()));
            }
        }
Example #3
0
        public IActionResult Ship(int id)
        {
            var order = orderRepository.Get(id);

            if (order == null)
            {
                return(NotFound());
            }
            orderRepository.Ship(id);
            return(RedirectToAction(nameof(ViewAllOrder)));
        }
        public OrderEditViewModel GetDetail(string id)
        {
            try {
                var order     = orderRepo.Get(id);
                var ordertail = orderDetailRepo.GetListByOrderId(id).ToList();
                var store     = storeRepo.GetAll().FirstOrDefault(c => c.Id == order.StoreId);
                var listuser  = userRepo.GetAll().ToList();

                var result = new OrderEditViewModel();
                result.orderTbl      = order;
                result.store         = store;
                result.listDetailTbl = ordertail;
                result.Sender        = listuser.FirstOrDefault(c => c.Id == order.SenderId);
                result.Recipient     = listuser.FirstOrDefault(c => c.Id == order.RecipientId);

                return(result);
            } catch (Exception e) {
                return(null);
            }
        }
Example #5
0
 public IEnumerable <Order> GetOrders(int?id)
 {
     return(orderRepo.Get(id));
 }