public ActionResult Bulletin(string packageid, FormCollection form)
        {
            SetMenuSelection("Apps");

            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Home"));
            }

            DBContext db   = new DBContext();
            var       list = from t in db.MetrixBulletinBoards
                             where t.PackageID == packageid
                             select t;

            //see if the version already exists
            MetrixBulletinBoard version = db.MetrixBulletinBoards.SingleOrDefault(i => i.PackageID == packageid);

            if (version == null)
            {
                version                      = new MetrixBulletinBoard();
                version.PackageID            = packageid;
                version.BulletinBoardVersion = 1;
                db.MetrixBulletinBoards.InsertOnSubmit(version);
                db.SubmitChanges();
            }

            ViewData["Version"]   = version;
            ViewData["Bulletins"] = list.ToList();
            ViewData["PID"]       = packageid;

            if (form.Count > 0)
            {
                #region Validate

                int versionNumber;
                try
                {
                    versionNumber = int.Parse(form["txtUpdateVersion"]);
                }
                catch
                {
                    ViewData["VersionStatus"] = "Version needs to be a number";
                    return(View());
                }

                #endregion

                version.BulletinBoardVersion = versionNumber;
                db.SubmitChanges();
                ViewData["VersionStatus"] = "Got it!";
            }

            return(View());
        }
        public ActionResult Bulletin(string packageid, FormCollection form)
        {
            SetMenuSelection("Apps");

            if (Session["UserID"] == null)
                return RedirectToAction("Login", "Home");

            DBContext db = new DBContext();
            var list = from t in db.MetrixBulletinBoards
                        where t.PackageID == packageid
                        select t;

            //see if the version already exists
            MetrixBulletinBoard version = db.MetrixBulletinBoards.SingleOrDefault(i => i.PackageID == packageid);
            if (version == null)
            {
                version = new MetrixBulletinBoard();
                version.PackageID = packageid;
                version.BulletinBoardVersion = 1;
                db.MetrixBulletinBoards.InsertOnSubmit(version);
                db.SubmitChanges();
            }

            ViewData["Version"] = version;
            ViewData["Bulletins"] = list.ToList();
            ViewData["PID"] = packageid;

            if (form.Count > 0)
            {
                #region Validate

                int versionNumber;
                try
                {
                    versionNumber = int.Parse(form["txtUpdateVersion"]);
                }
                catch
                {
                    ViewData["VersionStatus"] = "Version needs to be a number";
                    return View();
                }

                #endregion

                version.BulletinBoardVersion = versionNumber;
                db.SubmitChanges();
                ViewData["VersionStatus"] = "Got it!";
            }

            return View();
        }