public async Task <PostStaticsDataset> GetPostStatisticsById(int id, string lang = "vi") { RecruitmentPost post = await _uow.RecruitmentRepository.GetFirst(filter : post => post.PostId == id); PostStaticsDataset result = _mapper.Map <PostStaticsDataset>(post); result.TotalCVs = (await _uow.AppliedCVRepository.Get(filter: p => p.PostId == post.PostId)).ToList().Count; result.NewCVs = (await _uow.AppliedCVRepository.Get(filter: p => p.PostId == post.PostId && !p.Viewed)).ToList().Count; return(result); }
public async Task <ActionResult <PostStaticsDataset> > GetRecruitmentPost([FromRoute] int postId, string lang = "vi") { PostStaticsDataset result = await _recruitmentService.GetPostStatisticsById(postId, lang); if (result != null) { return(Ok(result)); } return(NotFound()); }