public ActionResult EditPost(Widget widget)
 {
     if (ModelState.IsValid)
     {
         db.Entry(widget).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Dashboard", "Home");
     }
     return View("~/Views/Home/Dashboard.cshtml", widget);
 }
        public ActionResult CreatePost(Widget widget, int? PortalUsers, string returnView)
        {
            if (!PortalUsers.HasValue)
                ModelState.AddModelError(string.Empty, "Please choose a user");

            if (ModelState.IsValid)
            {
                db.Widgets.Add(widget);
                db.SaveChanges();
                db.WebPortalLoginCredentials.Find(PortalUsers).Widgets.Add(widget);
                db.SaveChanges();
                return RedirectToAction("Dashboard", "Home");
            }

            ViewBag.PortalUsers = new SelectList(db.WebPortalLoginCredentials.ToList(), "WebPortalLoginCredentialId", "Username", PortalUsers);
            return View("~/Views/Home/Dashboard.cshtml", widget);
        }