public async Task <IActionResult> UploadSalesOrder([FromForm] SalesOrderViewModel model) { if (model.FileTemplate != null || model.FileTemplate.Length > 0) { using (var ms = new MemoryStream()) { model.FileTemplate.CopyTo(ms); ms.Seek(0, SeekOrigin.Begin); var response = await _applicationServices.PostSalesOrder(ms, new SalesOrderHeader { ExternalReference = model.ExternalReference, Name = model.Description, DataOriginTypeCode = model.DataOriginTypeCode, DeliveryPriorityCode = model.DeliveryPriorityCode, DistributionChannelCode = model.DistributionChannelCode, SalesUnitPartyId = model.SalesUnit, EmployeeResponsible = model.EmployeeResponsible, PostingDate = model.PostingDate.HasValue ? model.PostingDate.Value.ToString() : null, AccountId = model.AccountId, BuyerPartyId = model.ExternalReference, StartDate = model.RequestedStartDate.Value.ToString("dd/MM/yyyy"), //EndDate = model.RequestedEndDate.Value.ToString("dd/MM/yyyy") }); if (response != null) { return(Ok(response)); } } } return(null); }