public ActionResult Create(Contact contact) { if (ModelState.IsValid) { if (Request.IsAjaxRequest()) { db.Contacts.Add(contact); db.SaveChanges(); return null; } db.Contacts.Add(contact); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Name", contact.OrganizationId); return View(contact); }
public JsonResult _CreateContact(Contact contact) { if (ModelState.IsValid) { if (Request.IsAjaxRequest()) { db.Contacts.Add(contact); db.SaveChanges(); return Json(contact, JsonRequestBehavior.AllowGet); } db.Contacts.Add(contact); db.SaveChanges(); return Json(contact, JsonRequestBehavior.AllowGet); } ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Name"); return Json("blerrggg"); }
public ActionResult _CreateContact(Contact contact) { if (ModelState.IsValid) { db.Contacts.Add(contact); db.SaveChanges(); return View("Evaluation"); } ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Name"); return View(); }
public ActionResult Edit(Contact contact) { if (ModelState.IsValid) { db.Entry(contact).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Name", contact.OrganizationId); return View(contact); }