public IActionResult Edit(Contact contact) { if (ModelState.IsValid) { if (contact.Id == 0) ViewBag.OperationResult = this.contactsRepository.AddContact(contact); else ViewBag.OperationResult = this.contactsRepository.UpdateContact(contact); } return RedirectToAction("Index"); }
public OperationResult<int> UpdateContact(Contact contact) { var result = new OperationResult<int>(); result.Data = table.Update(contact, contact.Id); return result; }
public OperationResult<Contact> AddContact(Contact contact) { var result = new OperationResult<Contact>(); table.Insert(contact.ForInsert()); return result; }