Exemplo n.º 1
0
        public async Task <ActionResult <long> > CountCompanyEmail([FromBody] Company_CompanyEmailFilterDTO Company_CompanyEmailFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }
            CompanyEmailFilter CompanyEmailFilter = new CompanyEmailFilter();

            CompanyEmailFilter.Id            = Company_CompanyEmailFilterDTO.Id;
            CompanyEmailFilter.Title         = Company_CompanyEmailFilterDTO.Title;
            CompanyEmailFilter.Content       = Company_CompanyEmailFilterDTO.Content;
            CompanyEmailFilter.CreatorId     = Company_CompanyEmailFilterDTO.CreatorId;
            CompanyEmailFilter.CreatedAt     = Company_CompanyEmailFilterDTO.CreatedAt;
            CompanyEmailFilter.CompanyId     = Company_CompanyEmailFilterDTO.CompanyId;
            CompanyEmailFilter.EmailStatusId = Company_CompanyEmailFilterDTO.EmailStatusId;
            CompanyEmailFilter.Reciepient    = Company_CompanyEmailFilterDTO.Reciepient;

            return(await CompanyEmailService.Count(CompanyEmailFilter));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <List <Company_CompanyEmailDTO> > > ListCompanyEmail([FromBody] Company_CompanyEmailFilterDTO Company_CompanyEmailFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }
            CompanyEmailFilter CompanyEmailFilter = new CompanyEmailFilter();

            CompanyEmailFilter.Skip          = Company_CompanyEmailFilterDTO.Skip;
            CompanyEmailFilter.Take          = Company_CompanyEmailFilterDTO.Take;
            CompanyEmailFilter.OrderBy       = CompanyEmailOrder.Id;
            CompanyEmailFilter.OrderType     = OrderType.ASC;
            CompanyEmailFilter.Selects       = CompanyEmailSelect.ALL;
            CompanyEmailFilter.Id            = Company_CompanyEmailFilterDTO.Id;
            CompanyEmailFilter.Title         = Company_CompanyEmailFilterDTO.Title;
            CompanyEmailFilter.Content       = Company_CompanyEmailFilterDTO.Content;
            CompanyEmailFilter.CreatorId     = Company_CompanyEmailFilterDTO.CreatorId;
            CompanyEmailFilter.CreatedAt     = Company_CompanyEmailFilterDTO.CreatedAt;
            CompanyEmailFilter.CompanyId     = Company_CompanyEmailFilterDTO.CompanyId;
            CompanyEmailFilter.EmailStatusId = Company_CompanyEmailFilterDTO.EmailStatusId;
            CompanyEmailFilter.Reciepient    = Company_CompanyEmailFilterDTO.Reciepient;

            List <CompanyEmail> CompanyEmails = await CompanyEmailService.List(CompanyEmailFilter);

            List <Company_CompanyEmailDTO> Company_CompanyEmailDTOs = CompanyEmails
                                                                      .Select(x => new Company_CompanyEmailDTO(x)).ToList();

            return(Company_CompanyEmailDTOs);
        }