示例#1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="id">Answer to the question</param>
 /// <param name="count">Random other answers</param>
 /// <returns></returns>
 private Capital[] GetCapitals(List<int> ids)
 {
     var capitals = new Capital[ids.Count];
     var db = new CapitalsRepository();
     int i = 0;
     foreach (var id in ids)
     {
         capitals[i] = GetCapital(db, id);
         i++;
     }
     return capitals;
 }
示例#2
0
        private Capital GetCapital(CapitalsRepository db, int id)
        {
            var capital = db.Capitals.Where(x => x.CapitalId == id).FirstOrDefault();
            if (capital == null)
                return new Capital { Name = "NOT_FOUND", Continent = "", Country = "" };

            return new Capital
            {
                Name = capital.Name,
                Country = capital.Country,
                Continent = capital.Continent
            };
        }