public async Task <IActionResult> Index()
        {
            var Users = await _userRepository.GetAll();

            var YearPlans = await _yearPlanRepository.GetAll();

            var Treatments = await _treatmentRepository.GetAll();

            var FieldsCount        = YearPlan.GetTotalFieldsCount(YearPlans);
            var FieldsArea         = YearPlan.GetTotalFieldsArea(YearPlans);
            var YearPlansCount     = YearPlans.Count();
            var InActiveUsersCount = AgroSup.Core.Domain.User.GetInActiveUsers(Users).Count();
            var TreatmentsCount    = Treatments.Count();

            var Model = new SummaryViewModel
            {
                TotalUsers       = Users.Count(),
                AverageFieldArea = Math.Round((double)FieldsArea / (YearPlansCount * 100), 2),
                AverageTreatmentCountPerField = Math.Round((double)TreatmentsCount / FieldsCount, 2),
                AverageYearPlansCountPerUser  = Math.Round((double)YearPlans.Count() / Users.Count(), 2),
                InActiveAccounts = InActiveUsersCount,
            };

            return(View(Model));
        }
 public IList <Treatment> GetTreatmentsByDiseaseHistoryId(int historyId)
 {
     return(_treatmentRepository.GetAll(x => x.DiseaseHistoryId == historyId,
                                        include: x => x.Include(t => t.Medicine)
                                        .Include(t => t.DiseaseHistory)
                                        .Include(t => t.DiseaseHistory)
                                        .ThenInclude(dh => dh.PatientInfo)));
 }
예제 #3
0
 public IEnumerable <Treatment> GetAll()
 {
     return(_treatmentRepository.GetAll());
 }