public IEnumerable <TransferDetail> GetRequests(int code)
        {
            XmlWarehouseTranfer createXml = new XmlWarehouseTranfer();
            string doc = createXml.Create(code);

            return(null);
            //var request = GetRequests().Where(t => t.Id == code).ToList();
            //return request;
        }
        public ProductTransfer Save(ProductTransfer productTransfer)
        {
            XmlWarehouseTranfer createXml = new XmlWarehouseTranfer();
            int idTransferencia           = 0;

            try
            {
                var _productTransfer = context.ProductTransfer.Add(productTransfer);
                context.SaveChanges();
                productTransfer.Id = _productTransfer.Id;
                idTransferencia    = _productTransfer.Id;

                foreach (ProductTransferDetail detail in productTransfer.products)
                {
                    detail.ProductTransfer_Id = _productTransfer.Id;
                    var _id = context.ProductTransferDetail.Add(detail);
                }

                context.SaveChanges();

                //Update Amounts
                IWarehouseProductRepository _warehouseProductRepository = new WarehouseProductRepository();

                foreach (ProductTransferDetail detail in productTransfer.products)
                {
                    _warehouseProductRepository.UpdateAmountByCodes(productTransfer.WarehouseOrigin,
                                                                    productTransfer.WarehouseDestiny, detail.Quantity, detail.ProductCode);
                }


                //save XML
                string doc = createXml.Create(idTransferencia);

                return(productTransfer);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }