Exemplo n.º 1
0
        private ContactFilter ConvertFilterContact(Contract_ContactFilterDTO Contract_ContactFilterDTO)
        {
            ContactFilter ContactFilter = new ContactFilter();

            ContactFilter.Selects   = ContactSelect.ALL;
            ContactFilter.Skip      = Contract_ContactFilterDTO.Skip;
            ContactFilter.Take      = Contract_ContactFilterDTO.Take;
            ContactFilter.OrderBy   = Contract_ContactFilterDTO.OrderBy;
            ContactFilter.OrderType = Contract_ContactFilterDTO.OrderType;

            ContactFilter.Id              = Contract_ContactFilterDTO.Id;
            ContactFilter.Name            = Contract_ContactFilterDTO.Name;
            ContactFilter.ProfessionId    = Contract_ContactFilterDTO.ProfessionId;
            ContactFilter.CompanyId       = Contract_ContactFilterDTO.CompanyId;
            ContactFilter.ProvinceId      = Contract_ContactFilterDTO.ProvinceId;
            ContactFilter.DistrictId      = Contract_ContactFilterDTO.DistrictId;
            ContactFilter.NationId        = Contract_ContactFilterDTO.NationId;
            ContactFilter.CustomerLeadId  = Contract_ContactFilterDTO.CustomerLeadId;
            ContactFilter.ImageId         = Contract_ContactFilterDTO.ImageId;
            ContactFilter.Description     = Contract_ContactFilterDTO.Description;
            ContactFilter.Address         = Contract_ContactFilterDTO.Address;
            ContactFilter.EmailOther      = Contract_ContactFilterDTO.EmailOther;
            ContactFilter.DateOfBirth     = Contract_ContactFilterDTO.DateOfBirth;
            ContactFilter.Phone           = Contract_ContactFilterDTO.Phone;
            ContactFilter.PhoneHome       = Contract_ContactFilterDTO.PhoneHome;
            ContactFilter.FAX             = Contract_ContactFilterDTO.FAX;
            ContactFilter.Email           = Contract_ContactFilterDTO.Email;
            ContactFilter.ZIPCode         = Contract_ContactFilterDTO.ZIPCode;
            ContactFilter.SexId           = Contract_ContactFilterDTO.SexId;
            ContactFilter.AppUserId       = Contract_ContactFilterDTO.AppUserId;
            ContactFilter.PositionId      = Contract_ContactFilterDTO.PositionId;
            ContactFilter.Department      = Contract_ContactFilterDTO.Department;
            ContactFilter.ContactStatusId = Contract_ContactFilterDTO.ContactStatusId;
            return(ContactFilter);
        }
Exemplo n.º 2
0
        public async Task <ActionResult <int> > CountContact([FromBody] Contract_ContactFilterDTO Contract_ContactFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            ContactFilter ContactFilter = ConvertFilterContact(Contract_ContactFilterDTO);

            ContactFilter = await ContactService.ToFilter(ContactFilter);

            int count = await ContactService.Count(ContactFilter);

            return(count);
        }
Exemplo n.º 3
0
        public async Task <ActionResult <List <Contract_ContactDTO> > > ListContact([FromBody] Contract_ContactFilterDTO Contract_ContactFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            ContactFilter ContactFilter = ConvertFilterContact(Contract_ContactFilterDTO);

            ContactFilter = await ContactService.ToFilter(ContactFilter);

            List <Contact> Contacts = await ContactService.List(ContactFilter);

            List <Contract_ContactDTO> Contract_ContactDTOs = Contacts
                                                              .Select(c => new Contract_ContactDTO(c)).ToList();

            return(Contract_ContactDTOs);
        }
        public async Task <ActionResult <List <Contract_ContactDTO> > > SingleListContact([FromBody] Contract_ContactFilterDTO Contract_ContactFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            ContactFilter ContactFilter = new ContactFilter();

            ContactFilter.Skip         = 0;
            ContactFilter.Take         = 20;
            ContactFilter.OrderBy      = ContactOrder.Id;
            ContactFilter.OrderType    = OrderType.ASC;
            ContactFilter.Selects      = ContactSelect.ALL;
            ContactFilter.Id           = Contract_ContactFilterDTO.Id;
            ContactFilter.Name         = Contract_ContactFilterDTO.Name;
            ContactFilter.ProfessionId = Contract_ContactFilterDTO.ProfessionId;
            ContactFilter.CompanyId    = Contract_ContactFilterDTO.CompanyId;

            List <Contact> Contacts = await ContactService.List(ContactFilter);

            List <Contract_ContactDTO> Contract_ContactDTOs = Contacts
                                                              .Select(x => new Contract_ContactDTO(x)).ToList();

            return(Contract_ContactDTOs);
        }