[HttpPost]/*, ValidateAntiForgeryToken]*/ public ActionResult AddContact(ContactModel model) { if (ModelState.IsValid && MainObject.CheckUserHasWriteAccess(model.MainId)) { model.Save(); return(PartialView("Partials/_contactList", ContactObject.GetContacts(model.MainId))); } return(null); }
public ContactModel(ContactObject contact) { if (contact != null) { SortMainId = contact.SortMainId; ContactId = contact.ContactId; EmployeeId = contact.EmployeeId; ContactType = contact.ContactType; Contacts = ContactObject.GetContacts(SortMainId); } }
[HttpPost]/*, ValidateAntiForgeryToken]*/ public ActionResult AddContact(ContactModel model) { if (ModelState.IsValid && SortMainObject.CheckUserHasWriteAccess(model.SortMainId)) { model.Save(); return(PartialView("Partials/_contactList", ContactObject.GetContacts(model.SortMainId))); } Response.StatusCode = (int)HttpStatusCode.BadRequest; return(null); }
public ContactModel(int mainId, int?contactId) { MainId = mainId; Contacts = ContactObject.GetContacts(mainId); if (contactId.HasValue) { var contact = ContactObject.GetContact(contactId.Value); if (contact != null) { ContactId = contact.ContactId; ContactEmployeeId = contact.EmployeeId; } } }
public ActionResult RemoveContact(int?id) { int mid = 0; if (id.HasValue) { var contact = ContactObject.GetContact(id.Value); if (contact != null) { mid = contact.MainId; if (MainObject.CheckUserHasWriteAccess(mid)) { contact.Delete(); } } } return(PartialView("Partials/_contactList", ContactObject.GetContacts(mid))); }