// // GET: /Business/Details/5 public ActionResult Details(int id = 0) { BusinessReviewViewModel businessReviewVM = new BusinessReviewViewModel(); businessReviewVM.businesses = db.Businesses.Find(id); if (businessReviewVM.businesses == null) { return(HttpNotFound()); } businessReviewVM.reviews = new List <Review>(); foreach (var item in db.Reviews.ToList()) { if (item.BusinessID == db.Businesses.Find(id).BusinessID) { businessReviewVM.reviews.Add(item); } } return(View(businessReviewVM)); }
// // GET: /Business/Details/5 public ActionResult Details(int id = 0) { BusinessReviewViewModel businessReviewVM = new BusinessReviewViewModel(); businessReviewVM.businesses = db.Businesses.Find(id); if (businessReviewVM.businesses == null) { return HttpNotFound(); } businessReviewVM.reviews = new List<Review>(); foreach (var item in db.Reviews.ToList()) { if (item.BusinessID == db.Businesses.Find(id).BusinessID) { businessReviewVM.reviews.Add(item); } } return View(businessReviewVM); }