public PartialViewResult FilterResourceCheckins(ListByDisasterViewModel model) { var result = new CheckinListsResultsViewModel(); if (model.SelectedDisaster != 0) { result.ResourceCheckins = _adminSvc.GetResourceCheckinsForDisaster(model.SelectedDisaster, model.CommitmentDate).ToList(); } return PartialView("_FilterResourceCheckinResults", result); }
public PartialViewResult Filter(ListByDisasterViewModel model) { var result = new CheckinListsResultsViewModel(); if (model.SelectedDisaster != 0) { result.OrganizationContacts = _adminSvc.GetContactsForDisaster(model.SelectedDisaster).ToList(); var volunteers = _adminSvc.GetVolunteersForDisaster(model.SelectedDisaster, model.CommitmentDate); if (model.CommitmentDate == null) { result.VolunteerCheckins = (from person in volunteers select new Person { Commitments = person.Commitments.Where(x => x.DisasterId == model.SelectedDisaster).ToList(), Email = person.Email, FirstName = person.FirstName, Organization = person.Organization, OrganizationId = person.OrganizationId, Id = person.Id, LastName = person.LastName, PhoneNumber = person.PhoneNumber, UserId = person.UserId }).ToList(); } else { result.VolunteerCheckins = (from person in volunteers select new Person { Commitments = person.Commitments.Where(x => x.DisasterId == model.SelectedDisaster && model.CommitmentDate >= x.StartDate && model.CommitmentDate <= x.EndDate).ToList(), Email = person.Email, FirstName = person.FirstName, Id = person.Id, LastName = person.LastName, PhoneNumber = person.PhoneNumber, UserId = person.UserId }).ToList(); } } return PartialView("_FilterResults", result); }