Пример #1
0
        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 <List <Contract_TaxTypeDTO> > > SingleListTaxType([FromBody] Contract_TaxTypeFilterDTO Contract_TaxTypeFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            TaxTypeFilter TaxTypeFilter = new TaxTypeFilter();

            TaxTypeFilter.Skip      = 0;
            TaxTypeFilter.Take      = 20;
            TaxTypeFilter.OrderBy   = TaxTypeOrder.Id;
            TaxTypeFilter.OrderType = OrderType.ASC;
            TaxTypeFilter.Selects   = TaxTypeSelect.ALL;
            TaxTypeFilter.Id        = Contract_TaxTypeFilterDTO.Id;
            TaxTypeFilter.Code      = Contract_TaxTypeFilterDTO.Code;
            TaxTypeFilter.Name      = Contract_TaxTypeFilterDTO.Name;
            TaxTypeFilter.StatusId  = new IdFilter {
                Equal = Enums.StatusEnum.ACTIVE.Id
            };

            List <TaxType> TaxTypes = await TaxTypeService.List(TaxTypeFilter);

            List <Contract_TaxTypeDTO> Contract_TaxTypeDTOs = TaxTypes
                                                              .Select(x => new Contract_TaxTypeDTO(x)).ToList();

            return(Contract_TaxTypeDTOs);
        }