コード例 #1
0
 public ActionResult MakeOrder(HotelOrderViewModel order)
 {
     try
     {
         var orderDto = Mapper.Map <HotelOrderDTO>(order);
         orderDto.Date = DateTime.Now;
         orderService.OrderHotel(orderDto);
         TempData["successful"] = string.Format("Спасибо, Ваш заказ успешно обработан.");
         return(RedirectToAction("Index"));
     }
     catch (ValidationException ex)
     {
         return(Content(ex.Message));
     }
 }
コード例 #2
0
        public ActionResult MakeOrder(int?id)
        {
            try
            {
                HotelDTO hotel = displayService.GetHotel(id.Value);
                var      order = new HotelOrderViewModel
                {
                    HotelId = hotel.Id,
                    Email   = System.Web.HttpContext.Current.User.Identity.Name,
                    Hotel   = hotel,
                };

                return(View(order));
            }
            catch (ValidationException ex)
            {
                return(Content(ex.Message));
            }
        }