private TicketFilter ConvertFilterTicket(Customer_TicketFilterDTO Customer_TicketFilterDTO)
        {
            TicketFilter TicketFilter = new TicketFilter();

            TicketFilter.Selects             = TicketSelect.ALL;
            TicketFilter.Skip                = Customer_TicketFilterDTO.Skip;
            TicketFilter.Take                = Customer_TicketFilterDTO.Take;
            TicketFilter.OrderBy             = Customer_TicketFilterDTO.OrderBy;
            TicketFilter.OrderType           = Customer_TicketFilterDTO.OrderType;
            TicketFilter.Id                  = Customer_TicketFilterDTO.Id;
            TicketFilter.Name                = Customer_TicketFilterDTO.Name;
            TicketFilter.Phone               = Customer_TicketFilterDTO.Phone;
            TicketFilter.CustomerId          = Customer_TicketFilterDTO.CustomerId;
            TicketFilter.UserId              = Customer_TicketFilterDTO.UserId;
            TicketFilter.CustomerTypeId      = Customer_TicketFilterDTO.CustomerTypeId;
            TicketFilter.ProductId           = Customer_TicketFilterDTO.ProductId;
            TicketFilter.ReceiveDate         = Customer_TicketFilterDTO.ReceiveDate;
            TicketFilter.ProcessDate         = Customer_TicketFilterDTO.ProcessDate;
            TicketFilter.FinishDate          = Customer_TicketFilterDTO.FinishDate;
            TicketFilter.Subject             = Customer_TicketFilterDTO.Subject;
            TicketFilter.Content             = Customer_TicketFilterDTO.Content;
            TicketFilter.TicketIssueLevelId  = Customer_TicketFilterDTO.TicketIssueLevelId;
            TicketFilter.TicketPriorityId    = Customer_TicketFilterDTO.TicketPriorityId;
            TicketFilter.TicketStatusId      = Customer_TicketFilterDTO.TicketStatusId;
            TicketFilter.TicketSourceId      = Customer_TicketFilterDTO.TicketSourceId;
            TicketFilter.TicketNumber        = Customer_TicketFilterDTO.TicketNumber;
            TicketFilter.DepartmentId        = Customer_TicketFilterDTO.DepartmentId;
            TicketFilter.RelatedTicketId     = Customer_TicketFilterDTO.RelatedTicketId;
            TicketFilter.SLA                 = Customer_TicketFilterDTO.SLA;
            TicketFilter.RelatedCallLogId    = Customer_TicketFilterDTO.RelatedCallLogId;
            TicketFilter.ResponseMethodId    = Customer_TicketFilterDTO.ResponseMethodId;
            TicketFilter.StatusId            = Customer_TicketFilterDTO.StatusId;
            TicketFilter.CreatedAt           = Customer_TicketFilterDTO.CreatedAt;
            TicketFilter.UpdatedAt           = Customer_TicketFilterDTO.UpdatedAt;
            TicketFilter.TicketResolveTypeId = Customer_TicketFilterDTO.TicketResolveTypeId;
            TicketFilter.ResolveContent      = Customer_TicketFilterDTO.ResolveContent;
            TicketFilter.closedAt            = Customer_TicketFilterDTO.closedAt;
            TicketFilter.AppUserClosedId     = Customer_TicketFilterDTO.AppUserClosedId;
            TicketFilter.FirstResponseAt     = Customer_TicketFilterDTO.FirstResponseAt;
            TicketFilter.LastResponseAt      = Customer_TicketFilterDTO.LastResponseAt;
            TicketFilter.LastHoldingAt       = Customer_TicketFilterDTO.LastHoldingAt;
            TicketFilter.ReraisedTimes       = Customer_TicketFilterDTO.ReraisedTimes;
            TicketFilter.ResolvedAt          = Customer_TicketFilterDTO.ResolvedAt;
            TicketFilter.AppUserResolvedId   = Customer_TicketFilterDTO.AppUserResolvedId;
            TicketFilter.SLAPolicyId         = Customer_TicketFilterDTO.SLAPolicyId;
            TicketFilter.HoldingTime         = Customer_TicketFilterDTO.HoldingTime;
            TicketFilter.ResolveTime         = Customer_TicketFilterDTO.ResolveTime;
            return(TicketFilter);
        }
        public async Task <ActionResult <int> > CountTicket([FromBody] Customer_TicketFilterDTO Customer_TicketFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            TicketFilter TicketFilter = ConvertFilterTicket(Customer_TicketFilterDTO);

            TicketFilter = await TicketService.ToFilter(TicketFilter);

            int count = await TicketService.Count(TicketFilter);

            return(count);
        }
        public async Task <ActionResult <List <Customer_TicketDTO> > > ListTicket([FromBody] Customer_TicketFilterDTO Customer_TicketFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            TicketFilter TicketFilter = ConvertFilterTicket(Customer_TicketFilterDTO);

            TicketFilter = await TicketService.ToFilter(TicketFilter);

            List <Ticket> Tickets = await TicketService.List(TicketFilter);

            List <Customer_TicketDTO> Customer_TicketDTOs = Tickets
                                                            .Select(c => new Customer_TicketDTO(c)).ToList();

            return(Customer_TicketDTOs);
        }