public async Task <ReportDiagramDTO> GetStatisticsAsync() { var totalcount = await this.dbcontext.Emails.CountAsync(); var repDiagram = new ReportDiagram { InvalidCount = this.dbcontext.Emails.Where(e => e.Status == EmailStatusesEnum.InvalidApplication).Count(), NotReviewedCount = this.dbcontext.Emails.Where(e => e.Status == EmailStatusesEnum.NotReviewed).Count(), NewCount = this.dbcontext.Emails.Where(e => e.Status == EmailStatusesEnum.New).Count(), OpenCount = this.dbcontext.Emails.Where(e => e.Status == EmailStatusesEnum.Open).Count(), ClosedCount = this.dbcontext.Emails.Where(e => e.Status == EmailStatusesEnum.Closed).Count(), RejectedCount = this.dbcontext.LoanApplications.Where(a => a.Status == LoanApplicationStatus.Rejected).Count(), AcceptedCount = this.dbcontext.LoanApplications.Where(a => a.Status == LoanApplicationStatus.Accepted).Count(), OnlineUsers = await this.dbcontext.Users.Where(u => u.IsOnline == true).Include(x => x.UserEmails).ToListAsync() }; return(this.reportDigramMapper.MapFrom(repDiagram)); }
public ReportDiagramDTO MapFrom(ReportDiagram entity) { return(new ReportDiagramDTO() { AcceptedCount = entity.AcceptedCount, NewCount = entity.NewCount, ClosedCount = entity.ClosedCount, InvalidCount = entity.InvalidCount, OpenCount = entity.OpenCount, NotReviewedCount = entity.NotReviewedCount, RejectedCount = entity.RejectedCount, PercentAccepted = entity.PercentAccepted, PercentClosed = entity.PercentClosed, PercentInvalid = entity.PercentInvalid, PercentNew = entity.PercentNew, PercentNotReviewed = entity.PercentNotReviewed, PercentOpen = entity.PercentOpen, PercentRejected = entity.PercentRejected, OnlineUsers = this.userDTOMapper.MapFrom(entity.OnlineUsers) }); }