public EditContactRequest(Contact contact) { Id = contact.Id; FirstName = contact.FirstName; LastName = contact.LastName; Email = contact.Email; Phone = contact.Phone; }
public void Add(Contact contact) { if (_contacts.Any()) contact.Id = _contacts.Max(c => c.Id) + 1; else contact.Id = 1; _contacts.Add(contact); }
public ActionResult Delete(Contact contactToDelete) { _repository.Delete(contactToDelete.Id); TempData["Message"] = "Contact deleted!"; return RedirectToAction("Index"); }
public void Edit(Contact contact) { Delete(contact.Id); _contacts.Add(contact); }