public ActionResult Create(Session session)
        {
            if (ModelState.IsValid)
            {
                db.Sessions.Add(session);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.SpeakerID = new SelectList(db.Speakers, "SpeakerID", "Name", session.SpeakerID);
            return View(session);
        }
        public ActionResult Create(Session session)
        {
            if(!ModelState.IsValid)
            {
                return View(session);
            }
            try
            {
                context.Sessions.Add(session);
                context.SaveChanges();
            }
            catch(Exception ex)
            {
                ModelState.AddModelError("Error", ex.Message);
                return View(session);
            }

            TempData["Message"] = "Created " + session.Title;

            return RedirectToAction("Index");
        }
 public ActionResult Edit(Session session)
 {
     if (ModelState.IsValid)
     {
         db.Entry(session).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.SpeakerID = new SelectList(db.Speakers, "SpeakerID", "Name", session.SpeakerID);
     return View(session);
 }