public void OrderTransport(TransportOrderDTO orderDTO) { TransportBooking order = new TransportBooking { DepartureDate = orderDTO.DepartureDate, Email = orderDTO.Email, Price = orderDTO.TransportType * 300, TransportType = orderDTO.TransportType }; Database.TransportOrders.Insert(order); Database.Save(); }
public ActionResult MakeOrder(TransportOrderViewModel order) { try { var orderDto = new TransportOrderDTO { TransportType = (int)order.TransportType, DepartureDate = order.DepartureDate, Email = System.Web.HttpContext.Current.User.Identity.Name }; orderService.OrderTransport(orderDto); TempData["successful"] = string.Format("Спасибо, Ваш заказ успешно обработан."); return(RedirectToAction("Index", "Home")); } catch (ValidationException ex) { return(Content(ex.Message)); } }