示例#1
0
        public async Task <ActionResult <long> > CountContactEmail([FromBody] Contact_ContactEmailFilterDTO Contact_ContactEmailFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }
            ContactEmailFilter ContactEmailFilter = new ContactEmailFilter();

            ContactEmailFilter.Id            = Contact_ContactEmailFilterDTO.Id;
            ContactEmailFilter.Title         = Contact_ContactEmailFilterDTO.Title;
            ContactEmailFilter.Content       = Contact_ContactEmailFilterDTO.Content;
            ContactEmailFilter.CreatorId     = Contact_ContactEmailFilterDTO.CreatorId;
            ContactEmailFilter.CreatedAt     = Contact_ContactEmailFilterDTO.CreatedAt;
            ContactEmailFilter.ContactId     = Contact_ContactEmailFilterDTO.ContactId;
            ContactEmailFilter.EmailStatusId = Contact_ContactEmailFilterDTO.EmailStatusId;
            ContactEmailFilter.Reciepient    = Contact_ContactEmailFilterDTO.Reciepient;

            return(await ContactEmailService.Count(ContactEmailFilter));
        }
示例#2
0
        public async Task <ActionResult <List <Contact_ContactEmailDTO> > > ListContactEmail([FromBody] Contact_ContactEmailFilterDTO Contact_ContactEmailFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }
            ContactEmailFilter ContactEmailFilter = new ContactEmailFilter();

            ContactEmailFilter.Skip          = Contact_ContactEmailFilterDTO.Skip;
            ContactEmailFilter.Take          = Contact_ContactEmailFilterDTO.Take;
            ContactEmailFilter.OrderBy       = ContactEmailOrder.Id;
            ContactEmailFilter.OrderType     = OrderType.ASC;
            ContactEmailFilter.Selects       = ContactEmailSelect.ALL;
            ContactEmailFilter.Id            = Contact_ContactEmailFilterDTO.Id;
            ContactEmailFilter.Title         = Contact_ContactEmailFilterDTO.Title;
            ContactEmailFilter.Content       = Contact_ContactEmailFilterDTO.Content;
            ContactEmailFilter.CreatorId     = Contact_ContactEmailFilterDTO.CreatorId;
            ContactEmailFilter.CreatedAt     = Contact_ContactEmailFilterDTO.CreatedAt;
            ContactEmailFilter.ContactId     = Contact_ContactEmailFilterDTO.ContactId;
            ContactEmailFilter.EmailStatusId = Contact_ContactEmailFilterDTO.EmailStatusId;
            ContactEmailFilter.Reciepient    = Contact_ContactEmailFilterDTO.Reciepient;

            List <ContactEmail> ContactEmails = await ContactEmailService.List(ContactEmailFilter);

            List <Contact_ContactEmailDTO> Contact_ContactEmailDTOs = ContactEmails
                                                                      .Select(x => new Contact_ContactEmailDTO(x)).ToList();

            return(Contact_ContactEmailDTOs);
        }