Ejemplo n.º 1
0
 public OrderModel Create(Order order)
 {
     return new OrderModel()
         {
             Url = OrderUrl(order),
             OrderID = order.ID,
             OrderDate = order.OrderDate,
             RestaurantID = order.RestaurantID,
             ClientID = order.ClientID,
             Restaurant = _restaurantModelFactory.Create(order.Restaurant),
             Client = _clientModelFactory.Create(order.Client)
         };
 }
Ejemplo n.º 2
0
 public OrderModel Create(Order order)
 {
     return new OrderModel()
     {
         Url = ControllerUrl(order),
         OrderID = order.ID,
         OrderDate = order.OrderDate,
         RestaurantID = order.RestaurantID,
         ClientID = order.ClientID,
         Restaurant = Create(order.Restaurant),
         Client = Create(order.Client),
         Items = order.Items.Select(i=>Create(i))
     };
 }
Ejemplo n.º 3
0
 private string OrderUrl(Order order)
 {
     return _urlHelper.Link("Orders", new { orderid = order.ID });
 }
Ejemplo n.º 4
0
 public OrderSummaryModel CreateSummary(Order order)
 {
     return new OrderSummaryModel()
         {
             OrderID = order.ID,
             OrderDate = order.OrderDate,
             Products = order.Items.Select(i=>CreateSummary(i)),
             TotalAmount = order.Items.Sum(i=>i.Product.Price * i.Quantity)
         };
 }