public ActionResult FoodBank(FoodBankViewModel vm)
        {
            // insert a new Food Bank based on the logged in users Site ID
            int?SiteID = Session["SiteID"] as int?;

            // Insert into foodbank table the user's Site ID
            string sql = String.Format(
                "INSERT INTO foodbank (SiteID) VALUES ({0}); ", SiteID.Value.ToString());

            SqlHelper.ExecuteNonQuery(sql);

            vm.SiteID        = SiteID.Value; // set the ID since it now exists
            vm.StatusMessage = "Succesfully added!";

            return(View(vm));
        }
        public ActionResult FoodBank()
        {
            // Get the logged in Site ID from the session
            int?SiteID = Session["SiteID"] as int?;

            // if there is none, redirect to the login page
            if (!SiteID.HasValue)
            {
                return(RedirectToAction("Login", "Account"));
            }

            FoodBankViewModel vm = new FoodBankViewModel();


            // find out if we have a food bank for this site already or not
            string sql = String.Format("SELECT COUNT(*) FROM foodbank WHERE SiteID = {0}; ", SiteID.Value.ToString());

            vm.FoodBankExists = Int32.Parse(SqlHelper.ExecuteScalar(sql).ToString()) > 0;

            return(View(vm));
        }