// GET: /api/OlympicMedalists/ public IEnumerable<OlympicMedalist> Get() { var ent = new OffLineAppTestEntities(); var dbResultSet = ent.OlympicMedalists.OrderBy(t => t.ID); var resultList = new List<OlympicMedalist>(); foreach (var result in dbResultSet) { var olympicMedalist = new OlympicMedalist() { city = result.city ?? "", year = result.year ?? 0, sport = result.sport ?? "", discipline = result.discipline ?? "", country = result.country ?? "", gender = result.gender ?? "", @event = result.@event ?? "", eventGender = result.eventGender ?? "", color = result.color ?? "", lastName = result.lastName ?? "", firstName = result.firstName ?? "" }; resultList.Add(olympicMedalist); } return resultList; }
// GET: /api/ColumnDomains/ public IEnumerable<KeyValuePair<string, List<string>>> Get() { var ent = new OffLineAppTestEntities(); var dbResultSet = ent.ColumnDomains.OrderBy(t => t.ID); var cityList = new List<string>(); var yearList = new List<string>(); var sportList = new List<string>(); var disciplineList = new List<string>(); var countryList = new List<string>(); var genderList = new List<string>(); var eventList = new List<string>(); var eventGenderList = new List<string>(); var colorList = new List<string>(); foreach (var result in dbResultSet) { var value = result.value ?? ""; switch (result.group) { case "cities": cityList.Add(value); break; case "years": yearList.Add(value); break; case "countries": countryList.Add(value); break; case "disciplines": disciplineList.Add(value); break; case "events": eventList.Add(value); break; case "sports": sportList.Add(value); break; case "genders": genderList.Add(value); break; case "eventGenders": eventGenderList.Add(value); break; case "colors": colorList.Add(value); break; default: break; } } var resultMap = new Dictionary<string,List<string>>(); resultMap.Add("cities", cityList); resultMap.Add("years", yearList); resultMap.Add("countries", countryList); resultMap.Add("disciplines", disciplineList); resultMap.Add("events", eventList); resultMap.Add("sports", sportList); resultMap.Add("genders", genderList); resultMap.Add("eventGenders", eventGenderList); resultMap.Add("colors", colorList); return resultMap; }