public ActionResult UpdateSave(PhoneContact phoneContact) { _phoneContacts = _phoneContacts.Select(c => c.Id == phoneContact.Id ? new PhoneContact(phoneContact.Id, phoneContact.Name, phoneContact.Phone) : c).ToList(); _phoneContacts = ContactsHandler.WriteToJsonFile(_phoneContacts); return(RedirectToAction("Index")); }
public ActionResult DeleteSave(PhoneContact phoneContact) { _phoneContacts.RemoveAll(c => c.Id == phoneContact.Id); _phoneContacts = ContactsHandler.WriteToJsonFile(_phoneContacts); return(RedirectToAction("Index")); }
public ActionResult AddSave(PhoneContact phoneContact) { _phoneContacts.Add(phoneContact); _phoneContacts = ContactsHandler.WriteToJsonFile(_phoneContacts); return(RedirectToAction("Index")); }