Exemplo n.º 1
0
        // GET: Orders/Details/5
        public async Task <ActionResult> Details(int id)
        {
            var order = await _orderService.GetById(id);

            if (order == null || order.Customer != Guid.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)))
            {
                return(NotFound());
            }

            var orderLines = await _oLService.GetByOrderId(order.Id);

            if (orderLines != null)
            {
                orderLines = orderLines.Where(oL => oL.ReturnedAt == null).ToList();
            }

            List <OrderLineVM> oLVMs = _mapper.Map <List <OrderLineVM> >(orderLines);

            ViewData["OrderId"] = order.Id;

            return(View(oLVMs));
        }