public ActionResult Action(tblContact objSubmit) { if (objSubmit.ID == 0) { objSubmit.DateCreated = DateTime.Now; objSubmit.DateUpdated = DateTime.Now; objSubmit.IsDeleted = false; objSubmit.IsViewed = false; contactRepository.Add(objSubmit); } else { var obj = contactRepository.GetById<tblContact>(objSubmit.ID); UpdateModel(obj); objSubmit.DateUpdated = DateTime.Now; contactRepository.Update(obj); } return Json(new { Error = false }, JsonRequestBehavior.AllowGet); }
public ActionResult AddContact(bool? gender, string name, string email, string phone, string birth, string project) { try { var contact = new tblContact() { Title = project, Address = string.Empty, DateCreated = DateTime.Now, DateUpdated = DateTime.Now, Email = email, IsDeleted = false, IsViewed = false, Name = name, Phone = phone }; var result = otherRepositoryFE.AddContact(contact); return Json(new { error = !result }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { Elmah.ErrorLog.GetDefault(System.Web.HttpContext.Current).Log(new Elmah.Error(ex)); } return Json(new { error = true }, JsonRequestBehavior.AllowGet); }