Example #1
0
        public IActionResult List()
        {
            IEnumerable <VirusCase> virusCases;

            if (User.IsInRole(Models.User.DOCTOR_ROLE))
            {
                var doctorId = User.FindFirstValue(ClaimTypes.NameIdentifier);
                virusCases = _virusCaseRepository.GetDoctorsVirusCases(doctorId);
            }
            else
            {
                virusCases = _virusCaseRepository.GetAll();
            }
            var list = virusCases.Select(x => new VirusCaseListViewModel()
            {
                Id                  = x.Id,
                Age                 = x.Age,
                ChildrenAmount      = x.ChildrenAmount,
                ClinicId            = _clinicRepository.GetClinicName(x.ClinicId),
                RegionId            = _regionRepository.GetName(x.RegionId),
                Gender              = x.Gender,
                Date                = x.Date,
                DateString          = x.Date.ToString("yyyy-MM-dd"),
                VirusPositive       = x.VirusPositive,
                VirusPositiveString = x.VirusPositive ? "Yes" : "No",
                WorkModeId          = _workModeRepository.GetName(x.WorkModeId)
            });


            return(View(list));
        }