public ActionResult Create([Bind(Include = "Id,Name,Age,Description,PetType")] Pet model) { if (ModelState.IsValid) { db.Pets.Add(model); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }
public PetFinderContext CreateContext() { var options = CreateOptions(Guid.NewGuid().ToString("N")); var context = new PetFinderContext(options); var initialGenders = new List <Gender> { new() { Name = "Macho", SerializedName = "MACHO" }, new() { Name = "Hembra", SerializedName = "HEMBRA" } }; context.Genders.AddRange(initialGenders); context.SaveChanges(); return(context); } }