private CompanyActivityFilter ConvertFilterDTOToFilterEntity(Company_CompanyActivityFilterDTO Company_CompanyActivityFilterDTO) { CompanyActivityFilter CompanyActivityFilter = new CompanyActivityFilter(); CompanyActivityFilter.Selects = CompanyActivitySelect.ALL; CompanyActivityFilter.Skip = Company_CompanyActivityFilterDTO.Skip; CompanyActivityFilter.Take = Company_CompanyActivityFilterDTO.Take; CompanyActivityFilter.OrderBy = Company_CompanyActivityFilterDTO.OrderBy; CompanyActivityFilter.OrderType = Company_CompanyActivityFilterDTO.OrderType; CompanyActivityFilter.Id = Company_CompanyActivityFilterDTO.Id; CompanyActivityFilter.Title = Company_CompanyActivityFilterDTO.Title; CompanyActivityFilter.FromDate = Company_CompanyActivityFilterDTO.FromDate; CompanyActivityFilter.ToDate = Company_CompanyActivityFilterDTO.ToDate; CompanyActivityFilter.ActivityTypeId = Company_CompanyActivityFilterDTO.ActivityTypeId; CompanyActivityFilter.ActivityPriorityId = Company_CompanyActivityFilterDTO.ActivityPriorityId; CompanyActivityFilter.Description = Company_CompanyActivityFilterDTO.Description; CompanyActivityFilter.Address = Company_CompanyActivityFilterDTO.Address; CompanyActivityFilter.CompanyId = Company_CompanyActivityFilterDTO.CompanyId; CompanyActivityFilter.AppUserId = Company_CompanyActivityFilterDTO.AppUserId; CompanyActivityFilter.ActivityStatusId = Company_CompanyActivityFilterDTO.ActivityStatusId; CompanyActivityFilter.CreatedAt = Company_CompanyActivityFilterDTO.CreatedAt; CompanyActivityFilter.UpdatedAt = Company_CompanyActivityFilterDTO.UpdatedAt; return(CompanyActivityFilter); }
public async Task <ActionResult <int> > CountActivity([FromBody] Company_CompanyActivityFilterDTO Company_CompanyActivityFilterDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } CompanyActivityFilter CompanyActivityFilter = ConvertFilterDTOToFilterEntity(Company_CompanyActivityFilterDTO); CompanyActivityFilter = await CompanyActivityService.ToFilter(CompanyActivityFilter); int count = await CompanyActivityService.Count(CompanyActivityFilter); return(count); }
public async Task <ActionResult <List <Company_CompanyActivityDTO> > > ListActivity([FromBody] Company_CompanyActivityFilterDTO Company_CompanyActivityFilterDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } CompanyActivityFilter CompanyActivityFilter = ConvertFilterDTOToFilterEntity(Company_CompanyActivityFilterDTO); CompanyActivityFilter = await CompanyActivityService.ToFilter(CompanyActivityFilter); List <CompanyActivity> CompanyActivities = await CompanyActivityService.List(CompanyActivityFilter); List <Company_CompanyActivityDTO> Company_CompanyActivityDTOs = CompanyActivities .Select(c => new Company_CompanyActivityDTO(c)).ToList(); return(Company_CompanyActivityDTOs); }