Ejemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            var people = this.peopleService.GetAll().ToList();

            var peopleModel = new PeopleListingPageViewModel();

            foreach (var person in people)
            {
                peopleModel.People.Add(new PeopleViewModel()
                {
                    Name              = person.Name,
                    City              = person.City,
                    HasReports        = person.Reports.Any(r => !r.IsArchived),
                    Id                = person.Id,
                    Image             = this.peopleService.GetPersonImageLink(person.Id).Result,
                    QuarantineEndDate = person.QuarantineEndDate.ToLongDateString(),
                    UCN               = person.UCN
                });
            }

            return(this.View(peopleModel));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index(string searchQuery)
        {
            var people = this.peopleService.GetAll()
                         .Where(p => p.Name.Contains(searchQuery) || p.UCN.StartsWith(searchQuery)).ToList();

            var peopleModel = new PeopleListingPageViewModel();

            foreach (var person in people)
            {
                peopleModel.People.Add(new PeopleViewModel()
                {
                    Name              = person.Name,
                    City              = person.City,
                    HasReports        = person.Reports.Any(r => !r.IsArchived),
                    Id                = person.Id,
                    Image             = this.peopleService.GetPersonImageLink(person.Id).Result,
                    QuarantineEndDate = person.QuarantineEndDate.ToShortTimeString(),
                    UCN               = person.UCN
                });
            }

            return(this.View("Index", peopleModel));
        }