Exemplo n.º 1
0
        public virtual ActionResult Create()
        {
            var model = new Create();
            PopulateRestaurantSelectList(model);

            return View(model);
        }
Exemplo n.º 2
0
        public virtual ActionResult Create(Create create)
        {
            if (ModelState.IsValid)
            {
                var review = Mapper.Map<Review>(create);
                review.WriterId = _httpContextService.GetUserId();

                _reviewRepository.Add(review);

                return RedirectToAction(MVC.Home.Index());
            }

            PopulateRestaurantSelectList(create);
            return View(create);
        }
Exemplo n.º 3
0
 private void PopulateRestaurantSelectList(Create model)
 {
     model.Restaurants = new SelectList(_restaurantRepository.GetAll(), "Id", "Name");
 }