private void CopyReturnRequestViewModel(ReturnRequestViewModel to, UOrder_Order fromOrder, MFulfillment_ReturnRequest fromReturnRequest, IReadOnlyList <MFulfillment_ReturnRequestReason> fromReturnRequestReasons)
        {
            //var toReturnRequestItems = new List<ReturnRequestViewItemModel>();
            //foreach (var fromReturnRequestItem in fromReturnRequest.Items)
            //{
            //    var fromOrderItem = fromOrder.OrderItems.Where(r => r.OrderItem.OrderItemId == fromReturnRequestItem.OrderItemId).Single();
            //    if (fromOrderItem.OrderItem.CanReturn)
            //    {
            //        var toReturnRequestItem = new ReturnRequestViewItemModel()
            //        {
            //            OrderReturnRequestItemId = fromReturnRequestItem.OrderReturnRequestItemId,
            //            Quantity = fromReturnRequestItem.Quantity,
            //            OrderItem = ReturnRequestOrderModelFactory.CreateReturnRequestOrderItemModel(fromOrder.OrderItems.Where(r => r.OrderItem.OrderItemId == fromOrderItem.OrderItem.OrderItemId).Single())
            //        };
            //        toReturnRequestItems.Add(toReturnRequestItem);
            //    }
            //}

            //to.OrderReturnRequestId = fromReturnRequest.OrderReturnRequestId;
            //to.ReturnRequestNumber = fromReturnRequest.ReturnRequestNumber;
            //to.ReturnTypeCode = (int)fromReturnRequest.ReturnType;
            //to.ReturnTypeName = GetReturnTypeName(fromReturnRequest.ReturnType);
            //to.ReasonTypeCode = fromReturnRequest.ReasonTypeCode;
            //to.ReasonTypeName = fromReturnRequestReasons.Where(r => r.ReturnRequestReasonTypeCode == fromReturnRequest.ReasonTypeCode).Single().Name;
            //to.Notes = fromReturnRequest.Notes;
            //to.Items = toReturnRequestItems;
            //to.OrderId = fromOrder.MOrder.OrderId;
            //to.OrderNumber = fromOrder.MOrder.OrderNumber;
        }
        public ReturnRequestViewModel CreateReturnRequestViewModel(UOrder_Order fromOrder, MFulfillment_ReturnRequest fromReturnRequest, IReadOnlyList <MFulfillment_ReturnRequestReason> fromReturnRequestReasons)
        {
            var to = new ReturnRequestViewModel();

            if (fromReturnRequest != null)
            {
                CopyReturnRequestViewModel(to, fromOrder, fromReturnRequest, fromReturnRequestReasons);
            }
            else
            {
                CopyReturnRequestViewModel(to, fromOrder);
            }
            return(to);
        }
 private void CopyReturnRequestViewModel(ReturnRequestViewModel to, UOrder_Order fromOrder)
 {
     to.OrderId     = fromOrder.MOrder.OrderId;
     to.OrderNumber = fromOrder.MOrder.OrderNumber;
 }