public JsonResult Edit(Event e) { if (ModelState.IsValid) { db.Entry(e).State = EntityState.Modified; db.SaveChanges(); return Json(e); } else { throw new Exception("Could not model bind event."); } }
public JsonResult Create(Event e) { if (ModelState.IsValid) { db.Events.Add(e); db.SaveChanges(); Response.AppendCookie(new HttpCookie("event", e.ID.ToString())); return Json(e); } else { throw new Exception("Could not model bind event."); } }