Esempio n. 1
0
        public ActionResult MakeOrder(int?id)
        {
            try
            {
                TourDTO tour  = displayService.GetTour(id);
                var     order = new TourOrderViewModel {
                    TourId = tour.Id, Tour = tour, Email = System.Web.HttpContext.Current.User.Identity.Name
                };

                return(View(order));
            }
            catch (ValidationException ex)
            {
                return(Content(ex.Message));
            }
        }
Esempio n. 2
0
 public ActionResult MakeOrder(TourOrderViewModel order)
 {
     try
     {
         var orderDto = new TourOrderDTO {
             TourId = order.TourId, Date = DateTime.Now, Email = order.Email
         };
         tourOrderService.MakeOrder(orderDto);
         TempData["successful"] = string.Format("Спасибо, Ваш заказ успешно обработан.");
         return(RedirectToAction("Index"));
     }
     catch (ValidationException ex)
     {
         ModelState.AddModelError(ex.Property, ex.Message);
     }
     return(View(order));
 }