public ActionResult Index() { var products = _productFacade.GetAll().Select(p => new ProductViewModel(p)).ToList(); foreach (var product in products) { product.HasAuction = _auctionFacade.GetByProductId(product.Id) .Any(a => a.IsActive || a.StartTime > DateTime.Now) || product.IsSold; } return(View(products)); }
public ActionResult <List <Product> > GetProducts() { return(Ok(_productFacade.GetAll())); }