コード例 #1
0
        //
        // 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));
        }
コード例 #2
0
        //
        // 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);
        }