Ejemplo n.º 1
0
        /*
         * Given a Contact ID, return that user's sports preferences
         */
        public List <string> GetUserSportPreferences(int contactId)
        {
            var sportPreferences = _sportPreferenceRepository.GetAllSportsPreferences();
            var userPrefs        = from s in sportPreferences
                                   where s.ContactID == contactId
                                   select s;

            if (userPrefs.ToList().Count < 1)
            {
                return(null);
            }

            var results = new List <string>();

            foreach (var sportPreference in userPrefs)
            {
                var sport = _sportRepository.GetSportById(sportPreference.SportID);
                results.Add(sport.SportName);
            }
            return(results);
        }
Ejemplo n.º 2
0
        /*
         * Given a Sport ID, return name of sport
         */
        public string GetSportNameById(int sportId)
        {
            var sport = _sportRepository.GetSportById(sportId);

            return(sport.SportName);
        }