Ejemplo n.º 1
0
        public static Library.Order MapOrder(Entities.Orders dbmodel)
        {
            Library.Order result = new Library.Order
            {
                OrderID    = dbmodel.OrderId,
                MyCustomer = MapCustomer(dbmodel.Customer),
                MyLocation = MapLocation(dbmodel.Location),

                MyTime      = dbmodel.TimeConfirmed,
                ProductList = dbmodel.OrderItems.Select(MapOrderItem).ToList(),
            };

            return(result);
        }
Ejemplo n.º 2
0
        /*------------------------------------------------------*/


        /* Order mapping */

        public static Entities.Orders MapOrder(Library.Order model)
        {
            Entities.Orders result = new Entities.Orders
            {
                OrderId    = model.OrderID,
                CustomerId = model.MyCustomer.CustomerId,
                LocationId = model.MyLocation.Id,

                TimeConfirmed = model.MyTime,
                OrderItems    = model.ProductList.Select(i => MapOrderItem(i, model)).ToList()
            };

            return(result);
        }
Ejemplo n.º 3
0
 public int CreateAddressandGetId(Entities.Orders order)
 {
     db.Orders.Add(order);
     db.SaveChanges();
     return(order.OrderId);
 }