コード例 #1
0
        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
        }
コード例 #2
0
 static SearchController()
 {
     animalData = AnimalData.GetInstance();
 }
コード例 #3
0
 static ListController()
 {
     animalData = AnimalData.GetInstance();
 }