public ActionResult addContact(string oper, LienContactGridModel addContact, string selectedLienId) { var context = new EFRepository(); if (oper.Equals("add")) { EFLienContact contact = new EFLienContact(); contact.Id = 0; contact.LienId = Convert.ToInt32(selectedLienId); contact.FirstName = addContact.FirstName; contact.LastName = addContact.LastName; contact.Role = addContact.Role; context.EFLienContacts.Add(contact); context.SaveChanges(); } return(Json(JSONResponseFactory.SuccessResponse())); }
public ActionResult editContact(string oper, LienContactGridModel editContact) { var context = new EFRepository(); if (oper.Equals("edit")) { EFLienContact contact = new EFLienContact(); contact.Id = Convert.ToInt32(editContact.Id); contact.LienId = Convert.ToInt32(editContact.LienId); contact.FirstName = editContact.FirstName; contact.LastName = editContact.LastName; contact.Role = editContact.Role; context.Entry(contact).State = EntityState.Modified; context.SaveChanges(); } return(Json(JSONResponseFactory.SuccessResponse())); }