public IActionResult NewContact(string newName, string newPhone) { Contact newContact = new Contact(newName, newPhone); db.Contacts.Add(newContact); db.SaveChanges(); return(Json(newContact)); }
public IActionResult AddContact(Contact newContact) { Console.WriteLine("##############################" + newContact.Name + " " + newContact.Number + "###########################"); if (newContact.Number != null) { _db.Contacts.Add(newContact); _db.SaveChanges(); return(RedirectToAction("Index")); } else { return(View()); } }
public IActionResult NewContact(Contact item) { db.Contacts.Add(item); db.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult Create(Contact contact) { db.Contacts.Add(contact); db.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult AddContact(Contact contact) { db.Contacts.Add(contact); db.SaveChanges(); return(RedirectToAction("ContactList")); }