public IEnumerable <ActivityViewModel> GetActivitiesByZip(string zip, int miles) { List <ActivityViewModel> ret = new List <ActivityViewModel>(); var activities = _allReadyDataAccess.ActivitiesByPostalCode(zip, miles); foreach (Activity activity in activities) { ret.Add(new ActivityViewModel(activity)); } return(ret); }
public IEnumerable <ActivityViewModel> GetCampaignsByPostalCode(string zip, int miles) { List <ActivityViewModel> ret = new List <ActivityViewModel>(); var campaigns = (from c in _allReadyDataAccess.ActivitiesByPostalCode(zip, miles) select c.Campaign).Distinct(); var activities = (from c in campaigns from p in c.Activities select p); foreach (Activity activity in activities) { ret.Add(new ActivityViewModel(activity)); } return(ret); }
public List <Models.Activity> Handle(AcitivitiesByPostalCodeQuery message) { return(dataAccess.ActivitiesByPostalCode(message.PostalCode, message.Distance).ToList()); }