public ActionResult EchoNamedArgs(string text, DateTime date, Contact contact) { return Json(new { text, date, contact }); }
[ActionName("SaveContact")] // Action alias public ActionResult SaveForm(Contact contact) { db.Entry(contact).State = EntityState.Modified; db.SaveChanges(); return Json(new { success = true, data = contact }); }
public DirectResult Create(Contact contact) { if (ModelState.IsValid) { db.Contacts.Add(contact); db.SaveChanges(); return Json(new { success = true }); } return Json(new { success = false }); }
public DirectResult Update(Contact contact) { db.Entry(contact).State = EntityState.Modified; db.SaveChanges(); return Json(db.Contacts.Find(contact.ID)); }