private void FetchRelationships(CfsAmount cfsamount) { var currentYear = DateTime.Today.Year; List <int> _years = new List <int>(); for (int i = currentYear; i < currentYear + 5; i++) { _years.Add(i); } cfsamount.Years = _years.Select(f => new SelectListItem() { Text = f.ToString(), Value = f.ToString() }); List <int> _levels = new List <int>(); for (int i = 1; i < 8; i++) { _levels.Add(i); } cfsamount.Levels = _levels.Select(f => new SelectListItem() { Text = f.ToString(), Value = f.ToString() }); cfsamount.Currencies = CC.Data.Currency.ConvertableCurrencies.Select(f => new SelectListItem() { Text = f, Value = f }); ViewBag.Countries = db.Countries.Select(f => new { Id = f.Id, Name = f.Name, Selected = f.CfsAmounts.Any(ca => ca.Id == cfsamount.Id) }) .OrderBy(f => f.Name) .ToList().Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name, Selected = c.Selected }); }