Пример #1
0
        public async Task <ActionResult> Create()
        {
            var petType = from PetType p in Enum.GetValues(typeof(PetType))
                          select new
            {
                ID   = p.ToString(),
                Name = p.ToString()
            };

            ViewBag.EnumList = new SelectList(petType, "ID", "Name");
            Country country = new Country();

            country.CountryList = new SelectList(await countryContext.GetCountryListAsync(), "Id", "IsoCode");
            ViewBag.CountryList = country.CountryList;
            return(View(new Policy()
            {
                Pets = new List <Pet>()
                {
                    new Pet()
                    {
                        PetType = PetType.Dog, DateOfBirth = DateTime.Now, PetName = "PetName"
                    }
                }
            }));
        }