public ActionResult Create(AnimalsCreateViewModel t, string newbreed, string newtype)
        {
            Animal animal = new Animal
            {
                Name   = t.Name,
                Gender = t.Gender,
                Breed  = (String.IsNullOrEmpty(newbreed)) ? t.Breed : newbreed,
                Type   = (String.IsNullOrEmpty(newtype)) ? t.Type : newtype
            };

            _db.Animals.Add(animal);
            _db.SaveChanges();
            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult Create()
        {
            AnimalsCreateViewModel animalsCreateViewModel = new AnimalsCreateViewModel();
            List <string>          breeds    = _db.Animals.Select(animal => animal.Breed).Distinct().ToList();
            List <SelectListItem>  breedssli = breeds.Select(breed => new SelectListItem {
                Text = breed, Value = breed
            }).ToList();

            List <string>         types    = _db.Animals.Select(animal => animal.Type).Distinct().ToList();
            List <SelectListItem> typessli = types.Select(breed => new SelectListItem {
                Text = breed, Value = breed
            }).ToList();

            animalsCreateViewModel.BreedList = breedssli;
            animalsCreateViewModel.TypeList  = typessli;

            return(View(animalsCreateViewModel));
        }