public NewAnimalViewModel()
        {
            AnimalData animalData = AnimalData.GetInstance();

            foreach (Size field in animalData.Sizes.ToList())
            {
                Sizes.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            foreach (Origin field in animalData.Origins.ToList())
            {
                Origins.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            foreach (Kind field in animalData.Kinds.ToList())
            {
                Kinds.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            foreach (Eat field in animalData.Eats.ToList())
            {
                Eats.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            // TODO #4 - populate the other List<SelectListItem>
            // collections needed in the view
        }
Beispiel #2
0
 static SearchController()
 {
     animalData = AnimalData.GetInstance();
 }
Beispiel #3
0
 static ListController()
 {
     animalData = AnimalData.GetInstance();
 }