示例#1
0
        public async Task <ContactViewModel> GetViewModel(string firstname, string lastname, string email, string subject)
        {
            var review = _reviewFactory.Create(firstname, lastname, email, subject);
            await _review.Create(review).ConfigureAwait(false);

            return(new ContactViewModel
            {
                FirstName = firstname,
                LastName = lastname,
                ReviewSent = true,
                ReviewsWritten = await _review.GetAll().CountAsync()
            });
        }
示例#2
0
        public async Task <IActionResult> AddReview(int restaurantId, EditReviewViewModel vm)
        {
            try
            {
                RestaurantReview review = (RestaurantReview)_reviewFactory.Create(vm);

                var createdReview = await _restaurantReviewsRepo.AddAsync(review);

                // TODO: Add insert logic here
                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception)
            {
                return(View());
            }
        }