public ActionResult UpdateResearch(tblresearch r)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("LogIn", "User"));
            }
            else
            {
                tblresearch rsh = res.tblresearches.Where(t => t.ResearchID == r.ResearchID).SingleOrDefault();
                rsh.Title       = r.Title;
                rsh.Description = r.Description;

                res.SaveChanges();
                return(RedirectToAction("Index", "User", new { id = rsh.UserID }));
            }
        }
        public ActionResult removeResearch(int id)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("LogIn", "User"));
            }
            else
            {
                int uid = Convert.ToInt32(Session["UserID"]);

                tblresearch r = res.tblresearches.Where(t => t.ResearchID == id).SingleOrDefault();
                res.tblresearches.Remove(r);

                res.SaveChanges();

                return(RedirectToAction("Index", "User", new { id = uid }));
            }
        }
        public ActionResult UpdateFeaturedResearch(tblresearch r, HttpPostedFileBase FeaturedImage)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("LogIn", "User"));
            }
            else
            {
                tblresearch rsh      = res.tblresearches.Where(t => t.ResearchID == r.ResearchID).SingleOrDefault();
                var         fileName = Path.GetFileName(FeaturedImage.FileName);
                var         path     = Path.Combine(Server.MapPath("~/Content/Images/Research"), fileName);
                FeaturedImage.SaveAs(path);

                rsh.FeaturedImage = fileName;

                res.SaveChanges();

                return(RedirectToAction("Index", "User", new { id = rsh.UserID }));
            }
        }
        public ActionResult AddResearch(tblresearch r, HttpPostedFileBase FeaturedImage)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("LogIn", "User"));
            }
            else
            {
                int uid      = Convert.ToInt32(Session["UserID"]);
                var fileName = Path.GetFileName(FeaturedImage.FileName);
                var path     = Path.Combine(Server.MapPath("~/Content/Images/Research"), fileName);
                FeaturedImage.SaveAs(path);

                r.UserID        = uid;
                r.FeaturedImage = fileName;

                res.tblresearches.Add(r);

                res.SaveChanges();

                return(RedirectToAction("Index", "User", new { id = uid }));
            }
        }