Пример #1
0
        public async Task <List <Ticket_CustomerDTO> > SingleListCustomer([FromBody] Ticket_CustomerFilterDTO Ticket_CustomerFilterDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            CustomerFilter CustomerFilter = new CustomerFilter();

            CustomerFilter.Skip               = 0;
            CustomerFilter.Take               = 20;
            CustomerFilter.OrderBy            = CustomerOrder.Id;
            CustomerFilter.OrderType          = OrderType.ASC;
            CustomerFilter.Selects            = CustomerSelect.ALL;
            CustomerFilter.Id                 = Ticket_CustomerFilterDTO.Id;
            CustomerFilter.Code               = Ticket_CustomerFilterDTO.Code;
            CustomerFilter.Name               = Ticket_CustomerFilterDTO.Name;
            CustomerFilter.Phone              = Ticket_CustomerFilterDTO.Phone;
            CustomerFilter.Address            = Ticket_CustomerFilterDTO.Address;
            CustomerFilter.NationId           = Ticket_CustomerFilterDTO.NationId;
            CustomerFilter.ProvinceId         = Ticket_CustomerFilterDTO.ProvinceId;
            CustomerFilter.DistrictId         = Ticket_CustomerFilterDTO.DistrictId;
            CustomerFilter.WardId             = Ticket_CustomerFilterDTO.WardId;
            CustomerFilter.CustomerTypeId     = Ticket_CustomerFilterDTO.CustomerTypeId;
            CustomerFilter.Birthday           = Ticket_CustomerFilterDTO.Birthday;
            CustomerFilter.Email              = Ticket_CustomerFilterDTO.Email;
            CustomerFilter.ProfessionId       = Ticket_CustomerFilterDTO.ProfessionId;
            CustomerFilter.CustomerResourceId = Ticket_CustomerFilterDTO.CustomerResourceId;
            CustomerFilter.SexId              = Ticket_CustomerFilterDTO.SexId;
            CustomerFilter.StatusId           = new IdFilter {
                Equal = StatusEnum.ACTIVE.Id
            };
            CustomerFilter.CompanyId        = Ticket_CustomerFilterDTO.CompanyId;
            CustomerFilter.ParentCompanyId  = Ticket_CustomerFilterDTO.ParentCompanyId;
            CustomerFilter.TaxCode          = Ticket_CustomerFilterDTO.TaxCode;
            CustomerFilter.Fax              = Ticket_CustomerFilterDTO.Fax;
            CustomerFilter.Website          = Ticket_CustomerFilterDTO.Website;
            CustomerFilter.NumberOfEmployee = Ticket_CustomerFilterDTO.NumberOfEmployee;
            CustomerFilter.BusinessTypeId   = Ticket_CustomerFilterDTO.BusinessTypeId;
            CustomerFilter.Investment       = Ticket_CustomerFilterDTO.Investment;
            CustomerFilter.RevenueAnnual    = Ticket_CustomerFilterDTO.RevenueAnnual;
            CustomerFilter.Descreption      = Ticket_CustomerFilterDTO.Descreption;

            List <Customer> Customers = await CustomerService.List(CustomerFilter);

            List <Ticket_CustomerDTO> Ticket_CustomerDTOs = Customers
                                                            .Select(x => new Ticket_CustomerDTO(x)).ToList();

            return(Ticket_CustomerDTOs);
        }
Пример #2
0
        public async Task <List <Ticket_CustomerDTO> > FilterListCustomer([FromBody] Ticket_CustomerFilterDTO Ticket_CustomerFilterDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            CustomerFilter CustomerFilter = new CustomerFilter();

            CustomerFilter.Skip      = 0;
            CustomerFilter.Take      = 20;
            CustomerFilter.OrderBy   = CustomerOrder.Id;
            CustomerFilter.OrderType = OrderType.ASC;
            CustomerFilter.Selects   = CustomerSelect.ALL;
            CustomerFilter.Id        = Ticket_CustomerFilterDTO.Id;
            CustomerFilter.Code      = Ticket_CustomerFilterDTO.Code;

            List <Customer> Customers = await CustomerService.List(CustomerFilter);

            List <Ticket_CustomerDTO> Ticket_CustomerDTOs = Customers
                                                            .Select(x => new Ticket_CustomerDTO(x)).ToList();

            return(Ticket_CustomerDTOs);
        }