Beispiel #1
0
        public Order Map(CreateOrEditViewModel createOrEdit)
        {
            Order order = new Order();

            if (createOrEdit.Id != null)
            {
                order = this.RequestHandler.Storage.GetRepository <IOrderRepository>().WithKey((int)createOrEdit.Id);
            }

            else
            {
                order.Created = DateTime.Now;
            }

            order.OrderStateId      = createOrEdit.OrderStateId;
            order.PaymentMethodId   = createOrEdit.PaymentMethodId;
            order.DeliveryMethodId  = createOrEdit.DeliveryMethodId;
            order.CustomerFirstName = createOrEdit.CustomerFirstName;
            order.CustomerLastName  = createOrEdit.CustomerLastName;
            order.CustomerPhone     = createOrEdit.CustomerPhone;
            order.CustomerEmail     = createOrEdit.CustomerEmail;
            order.CustomerAddress   = createOrEdit.CustomerAddress;
            order.Note = createOrEdit.Note;
            return(order);
        }
        public Order Map(Order order, CreateOrEditViewModel createOrEdit)
        {
            if (order.Id == 0)
            {
                order.Created = DateTime.Now;
            }

            order.OrderStateId      = createOrEdit.OrderStateId;
            order.DeliveryMethodId  = createOrEdit.DeliveryMethodId;
            order.PaymentMethodId   = createOrEdit.PaymentMethodId;
            order.CustomerFirstName = createOrEdit.CustomerFirstName;
            order.CustomerLastName  = createOrEdit.CustomerLastName;
            order.CustomerPhone     = createOrEdit.CustomerPhone;
            order.CustomerEmail     = createOrEdit.CustomerEmail;
            order.CustomerAddress   = createOrEdit.CustomerAddress;
            order.Note = createOrEdit.Note;
            return(order);
        }