Exemplo n.º 1
0
        public IActionResult NewContact(string newName, string newPhone)
        {
            Contact newContact = new Contact(newName, newPhone);

            db.Contacts.Add(newContact);
            db.SaveChanges();
            return(Json(newContact));
        }
Exemplo n.º 2
0
 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());
     }
 }
Exemplo n.º 3
0
 public IActionResult NewContact(Contact item)
 {
     db.Contacts.Add(item);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 4
0
 public IActionResult Create(Contact contact)
 {
     db.Contacts.Add(contact);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 5
0
 public IActionResult AddContact(Contact contact)
 {
     db.Contacts.Add(contact);
     db.SaveChanges();
     return(RedirectToAction("ContactList"));
 }