public ActionResult Create([Bind(Include = "ID,Name,Address,Phone,Email")] PersonModel personModel)
        {
            if (ModelState.IsValid)
            {
                db.PersonModelDB.Add(personModel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(personModel));
        }
Beispiel #2
0
 private void AddNewPersonsWithAnimals()
 {
     using (var dbContext = new PersonModelContext())
     {
         dbContext.Persons.AddRange(persons);
         dbContext.SaveChanges();
     }
 }