public ActionResult AddFAQ()
        {
            ViewBag.myContentGroups = DBEvent.ContentGroups();
            FAQ m_FAQ = new FAQ();

            return View("AddFAQ", m_FAQ);
        }
Exemple #2
0
        public static void CreateFAQ(FAQ m_FAQ)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "INSERT INTO CMS_FAQs(faqName, contentGroup) VALUES(@faqName, @contentGroup)";
            SqlCommand insertFAQ = new SqlCommand(queryString, conn);
            insertFAQ.Parameters.AddWithValue("faqName", m_FAQ.FaqName);
            insertFAQ.Parameters.AddWithValue("contentGroup", m_FAQ.ContentGroup);
            insertFAQ.ExecuteNonQuery();

            conn.Close();
        }
        public ActionResult EditFAQ(FAQ m_FAQ)
        {
            ViewBag.myContentGroups = DBEvent.ContentGroups();

            if (ModelState.IsValid)
            {
                FAQRepository.UpdateFAQ(m_FAQ);
                return RedirectToAction("Index", "FAQ");
            }
            else
            {
                return View("EditFAQ", m_FAQ);
            }
        }
 public bool UpdateFAQ(FAQ m_FAQ)
 {
     DBFAQ.UpdateFAQ(m_FAQ);
     return true;
 }
 public bool CreateFAQ(FAQ m_FAQ)
 {
     DBFAQ.CreateFAQ(m_FAQ);
     return true;
 }
Exemple #6
0
        public static void UpdateFAQ(FAQ m_FAQ)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "UPDATE CMS_FAQs SET faqName = @faqName, contentGroup = @contentGroup WHERE id = @id";
            SqlCommand updateFAQ = new SqlCommand(queryString, conn);
            updateFAQ.Parameters.AddWithValue("faqName", m_FAQ.FaqName);
            updateFAQ.Parameters.AddWithValue("contentGroup", m_FAQ.ContentGroup);
            updateFAQ.Parameters.AddWithValue("id", m_FAQ.FaqID);
            updateFAQ.ExecuteNonQuery();

            conn.Close();
        }
Exemple #7
0
        public static FAQ RetrieveOneFAQ(int m_FaqID)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "SELECT * FROM CMS_FAQs WHERE id = @id AND pageWorkFlowState != 4";
            SqlCommand getFAQ = new SqlCommand(queryString, conn);
            getFAQ.Parameters.AddWithValue("id", m_FaqID);

            SqlDataReader myFAQ = getFAQ.ExecuteReader();

            FAQ tempFAQ = new FAQ();

            if (myFAQ.Read())
            {
                tempFAQ.FaqID = myFAQ.GetInt32(0);
                tempFAQ.FaqName = myFAQ.GetString(1);
                tempFAQ.ContentGroup = myFAQ.GetInt32(2);
            }

            conn.Close();
            return tempFAQ;
        }
Exemple #8
0
        public static List<FAQ> RetrieveAllFAQ()
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "SELECT * FROM CMS_FAQs WHERE pageWorkFlowState != 4";
            SqlCommand getFAQs = new SqlCommand(queryString, conn);
            SqlDataReader m_FAQs = getFAQs.ExecuteReader();

            List<FAQ> myFAQs = new List<FAQ>();

            while (m_FAQs.Read())
            {
                FAQ tempFAQ = new FAQ();
                tempFAQ.FaqID = m_FAQs.GetInt32(0);
                tempFAQ.FaqName = m_FAQs.GetString(1);
                tempFAQ.ContentGroup = m_FAQs.GetInt32(2);
                myFAQs.Add(tempFAQ);
            }

            conn.Close();
            return myFAQs;
        }