Example #1
0
        private Restaurant BuildRestaurantAndReviews(params int[] ratings)
        {
            var restaurant = new Restaurant();

            restaurant.Reviews =
                ratings.Select(r => new RestaurantReview { Rating = r })
                .ToList();
            return restaurant;
        }
        public ActionResult Create(Restaurant restaurant)
        {
            if (ModelState.IsValid)
            {
                _repo.AddRestaurant(restaurant);
                return RedirectToAction("Index");
            }

            return View(restaurant);
        }
        public bool EditRestaurant(Restaurant restaurant)
        {
            try
            {
                _ctx.Entry(restaurant).State = System.Data.EntityState.Modified;

                return (this.Save());
            }
            catch
            {
                return false;
            }
        }
 public RestaurantRater(Restaurant restaurant)
 {
     // TODO: Complete member initialization
     this._restaurant = restaurant ;
 }
 public bool EditRestaurant(Restaurant restaurant)
 {
     throw new NotImplementedException();
 }
 public bool AddRestaurant(Restaurant restaurant)
 {
     return true;
 }