Esempio n. 1
0
 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");
 }
Esempio n. 2
0
 public OperationResult<int> UpdateContact(Contact contact)
 {
     var result = new OperationResult<int>();
     result.Data = table.Update(contact, contact.Id);
     return result;
 }
Esempio n. 3
0
 public OperationResult<Contact> AddContact(Contact contact)
 {
     var result = new OperationResult<Contact>();
     table.Insert(contact.ForInsert());
     return result;
 }