Ejemplo n.º 1
0
        public IActionResult ReturnNoCustomerKnown(Guid id)
        {
            var orders = _orderService.All();

            foreach (var order in orders)
            {
                var orderLines = _orderLineService.FindByOrderId(order.Id);
                foreach (var orderLine in orderLines)
                {
                    if (!orderLine.ReturnedAt.HasValue && orderLine.ArticleId == id)
                    {
                        if (!_orderLineService.Return(orderLine.Id, DateTime.Now))
                        {
                            CheckInViewModel.Error = $"Het artikel '{orderLine.ProductName} [{orderLine.ArticleId}]' kon niet worden ingechecked";
                        }
                        return(RedirectToAction("CheckIn"));
                    }
                }
            }
            return(RedirectToAction("CheckIn"));
        }