private void FillOlympiads() { Olympiads.Clear(); foreach (var item in db.Olympiads.ToList()) { Olympiads.Add(item); } OlympiadCount = Olympiads.Count; }
public void PopulateDropdown() { Olympiads.Clear(); var context = DataEntitiesProvider.Provide(); foreach (var o in context.Olympiad_Infoes.OrderByDescending(x => x.StartDate)) { Olympiads.Add(new OlympiadVm { Text = o.FullTitle(), Id = o.Id }); } OlympiadId = Olympiads.First().Id; }
public void PopulateOlympiadDropdown() { Olympiads.Clear(); var context = DataEntitiesProvider.Provide(); foreach (var c in context.Olympiad_Infoes .OrderByDescending(x => x.StartDate)) { Olympiads.Add(new OlympiadVm { Text = c.FullTitle(), Value = c.Id }); } CurrentOlympiadId = Olympiads.First().Value; }
public void PopulateDropdown(string eventCode = null, int olympiadId = -1) { Events.Clear(); var context = DataEntitiesProvider.Provide(); Olympiad_Info currentOlympiad; if (olympiadId < 1) { currentOlympiad = context.Olympiad_Infoes.OrderByDescending(x => x.StartDate).First(); } else { currentOlympiad = context.Olympiad_Infoes.First(x => x.Id == olympiadId); } CurrentOlympiadId = currentOlympiad.Id; foreach (var e in currentOlympiad.Events.Where(x => !x.Code.StartsWith("ZZ")) .OrderBy(x => x.Code)) { Events.Add(new EventVm { Text = e.Code + " " + e.Mind_Sport, Value = e.Code }); } if (eventCode == null) { EventCode = (Events.Any()) ? Events.First().Value : null; } else { EventCode = eventCode; } Types.Clear(); Types.Add(new TypeVm() { Value = null, Text = "(normal)" }); Types.Add(new TypeVm() { Value = "Beginners'", Text = "Beginners'" }); Fees.Clear(); Fees.Add(new EntryFeeVm() { Value = null, Text = "(none)" }); foreach (var f in context.Fees.OrderBy(x => x.Code)) { Fees.Add(new EntryFeeVm() { Value = f.Code, Text = f.DropdownText }); } Locations.Clear(); Locations.Add(new LocationVm() { Value = null, Text = "(no location)" }); foreach (var l in currentOlympiad.Locations.OrderBy(x => x.Location1)) { Locations.Add(new LocationVm() { Value = l.Location1, Text = l.Location1 }); } Olympiads.Clear(); foreach (var o in context.Olympiad_Infoes.OrderByDescending(x => x.StartDate)) { Olympiads.Add(new OlympiadVm { Text = o.FullTitle(), Id = o.Id }); } }