public async Task <ActionResult <int> > CountOpportunity([FromBody] Contact_OpportunityFilterDTO Contact_OpportunityFilterDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } OpportunityFilter OpportunityFilter = ConvertFilterOpportunity(Contact_OpportunityFilterDTO); OpportunityFilter = await OpportunityService.ToFilter(OpportunityFilter); int count = await OpportunityService.Count(OpportunityFilter); return(count); }
public async Task <ActionResult <List <Contact_OpportunityDTO> > > ListOpportunity([FromBody] Contact_OpportunityFilterDTO Contact_OpportunityFilterDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } OpportunityFilter OpportunityFilter = ConvertFilterOpportunity(Contact_OpportunityFilterDTO); OpportunityFilter = await OpportunityService.ToFilter(OpportunityFilter); List <Opportunity> Opportunities = await OpportunityService.List(OpportunityFilter); List <Contact_OpportunityDTO> Contact_OpportunityDTOs = Opportunities .Select(c => new Contact_OpportunityDTO(c)).ToList(); return(Contact_OpportunityDTOs); }