public async Task <List <Role_CustomerGroupingDTO> > SingleListCustomerGrouping([FromBody] Role_CustomerGroupingFilterDTO Role_CustomerGroupingFilterDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            CustomerGroupingFilter CustomerGroupingFilter = new CustomerGroupingFilter();

            CustomerGroupingFilter.Skip           = 0;
            CustomerGroupingFilter.Take           = int.MaxValue;
            CustomerGroupingFilter.OrderBy        = CustomerGroupingOrder.Id;
            CustomerGroupingFilter.OrderType      = OrderType.ASC;
            CustomerGroupingFilter.Selects        = CustomerGroupingSelect.ALL;
            CustomerGroupingFilter.Id             = Role_CustomerGroupingFilterDTO.Id;
            CustomerGroupingFilter.Name           = Role_CustomerGroupingFilterDTO.Name;
            CustomerGroupingFilter.Code           = Role_CustomerGroupingFilterDTO.Code;
            CustomerGroupingFilter.Path           = Role_CustomerGroupingFilterDTO.Path;
            CustomerGroupingFilter.CustomerTypeId = Role_CustomerGroupingFilterDTO.CustomerTypeId;
            CustomerGroupingFilter.Level          = Role_CustomerGroupingFilterDTO.Level;
            CustomerGroupingFilter.StatusId       = Role_CustomerGroupingFilterDTO.StatusId;
            CustomerGroupingFilter.Description    = Role_CustomerGroupingFilterDTO.Description;
            CustomerGroupingFilter.ParentId       = Role_CustomerGroupingFilterDTO.ParentId;

            List <CustomerGrouping> CustomerGroupings = await CustomerGroupingService.List(CustomerGroupingFilter);

            List <Role_CustomerGroupingDTO> Role_CustomerGroupingDTOs = CustomerGroupings
                                                                        .Select(x => new Role_CustomerGroupingDTO(x)).ToList();

            return(Role_CustomerGroupingDTOs);
        }
Example #2
0
        public async Task <ActionResult <List <CustomerGrouping_CustomerGroupingDTO> > > FilterListCustomerGroupinging([FromBody] CustomerGrouping_CustomerGroupingFilterDTO CustomerGrouping_CustomerGroupingFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            CustomerGroupingFilter CustomerGroupingFilter = new CustomerGroupingFilter();

            CustomerGroupingFilter.Skip           = 0;
            CustomerGroupingFilter.Take           = int.MaxValue;
            CustomerGroupingFilter.OrderBy        = CustomerGroupingOrder.Id;
            CustomerGroupingFilter.OrderType      = OrderType.ASC;
            CustomerGroupingFilter.Selects        = CustomerGroupingSelect.ALL;
            CustomerGroupingFilter.Id             = CustomerGrouping_CustomerGroupingFilterDTO.Id;
            CustomerGroupingFilter.Code           = CustomerGrouping_CustomerGroupingFilterDTO.Code;
            CustomerGroupingFilter.Name           = CustomerGrouping_CustomerGroupingFilterDTO.Name;
            CustomerGroupingFilter.CustomerTypeId = CustomerGrouping_CustomerGroupingFilterDTO.CustomerTypeId;
            CustomerGroupingFilter.ParentId       = CustomerGrouping_CustomerGroupingFilterDTO.ParentId;
            CustomerGroupingFilter.Path           = CustomerGrouping_CustomerGroupingFilterDTO.Path;
            CustomerGroupingFilter.Level          = CustomerGrouping_CustomerGroupingFilterDTO.Level;
            CustomerGroupingFilter.StatusId       = CustomerGrouping_CustomerGroupingFilterDTO.StatusId;
            CustomerGroupingFilter.Description    = CustomerGrouping_CustomerGroupingFilterDTO.Description;

            List <CustomerGrouping> CustomerGroupings = await CustomerGroupingService.List(CustomerGroupingFilter);

            List <CustomerGrouping_CustomerGroupingDTO> CustomerGrouping_CustomerGroupingDTOs = CustomerGroupings
                                                                                                .Select(x => new CustomerGrouping_CustomerGroupingDTO(x)).ToList();

            return(CustomerGrouping_CustomerGroupingDTOs);
        }