public async Task <ActionResult <Company_DirectSalesOrderDTO> > GetDirectSalesOrder([FromBody] Company_DirectSalesOrderDTO Company_DirectSalesOrderDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } DirectSalesOrder DirectSalesOrder = await DirectSalesOrderService.Get(Company_DirectSalesOrderDTO.Id); List <TaxType> TaxTypes = await TaxTypeService.List(new TaxTypeFilter { Skip = 0, Take = int.MaxValue, Selects = TaxTypeSelect.ALL }); Company_DirectSalesOrderDTO = new Company_DirectSalesOrderDTO(DirectSalesOrder); foreach (var DirectSalesOrderContent in Company_DirectSalesOrderDTO.DirectSalesOrderContents) { TaxType TaxType = TaxTypes.Where(x => x.Percentage == DirectSalesOrderContent.TaxPercentage).FirstOrDefault(); DirectSalesOrderContent.TaxType = new Company_TaxTypeDTO(TaxType); } return(Company_DirectSalesOrderDTO); }
public async Task <ActionResult <Contact_DirectSalesOrderDTO> > GetDirectSalesOrder([FromBody] Contact_DirectSalesOrderDTO Contact_DirectSalesOrderDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } DirectSalesOrder DirectSalesOrder = await DirectSalesOrderService.Get(Contact_DirectSalesOrderDTO.Id); return(new Contact_DirectSalesOrderDTO(DirectSalesOrder)); }