コード例 #1
0
        //private readonly ILogger<HomeController> _logger;

        //public HomeController(ILogger<HomeController> logger)
        //{
        //    _logger = logger;
        //}

        public ActionResult Index(string Cuisine)
        {
            List <VendorCuisineLocationRating> VCLR = new List <VendorCuisineLocationRating>();
            List <VendorModel> Vendors = VendorManager.GetActiveVendors();

            if (!string.IsNullOrEmpty(Cuisine))
            {
                ViewBag.Cuisine = Cuisine.ToLower();
            }

            foreach (VendorModel item in Vendors)
            {
                VCLR.Add(new VendorCuisineLocationRating
                {
                    Vendor         = item,
                    VendorLocation = VendorLocationManager.GetVendorLocations().Any(v => v.VendorID == item.VendorID) == false ? new VendorLocationModel(): VendorLocationManager.GetVendorLocation(item.VendorID),
                    Reviews        = ReviewManager.GetReviews(item.VendorID),
                    Cuisine        = CuisineManager.GetCuisines().Any(v => v.VendorID == item.VendorID) == false ? new CuisineModel() : CuisineManager.GetVendorCuisine(item.VendorID)
                });
            }
            return(View(VCLR));
        }