public ActionResult DeleteConfirmed(int id)
        {
            VidlyMessage vidlyMessage = db.VidlyMessages.Find(id);

            db.VidlyMessages.Remove(vidlyMessage);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id,creatorID,msgSubject,msgBody,msgDate,parentMsgID")] VidlyMessage vidlyMessage)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vidlyMessage).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.creatorID = new SelectList(db.Users, "UserEmail", "Username", vidlyMessage.creatorID);
     return(View(vidlyMessage));
 }
        public ActionResult Create([Bind(Include = "id,creatorID,msgSubject,msgBody,msgDate,parentMsgID")] VidlyMessage vidlyMessage)
        {
            if (ModelState.IsValid)
            {
                vidlyMessage.creatorID = Session["UserEmail"].ToString();
                vidlyMessage.msgDate   = DateTime.Now;
                db.VidlyMessages.Add(vidlyMessage);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.creatorID = new SelectList(db.Users, "UserEmail", "Username", vidlyMessage.creatorID);
            return(View(vidlyMessage));
        }
        // GET: VidlyMessages/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VidlyMessage vidlyMessage = db.VidlyMessages.Find(id);

            if (vidlyMessage == null)
            {
                return(HttpNotFound());
            }
            return(View(vidlyMessage));
        }
        // GET: VidlyMessages/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VidlyMessage vidlyMessage = db.VidlyMessages.Find(id);

            if (vidlyMessage == null)
            {
                return(HttpNotFound());
            }
            ViewBag.creatorID = new SelectList(db.Users, "UserEmail", "Username", vidlyMessage.creatorID);
            return(View(vidlyMessage));
        }