deleteQuestion() public méthode

public deleteQuestion ( ) : void
Résultat void
Exemple #1
0
        /// <summary>
        /// Calls the model method to delete Questions based on the Question ID and refreshes the view to display the updated list of questions.
        /// Currently all logged in user can delete question associated with their account. Need to enforce some type of
        /// Authorization based on user type.
        /// </summary>
        /// <param name="questionid"></param>
        /// <param name="id">Question ID to be deleted</param>
        /// <param name="name"></param>
        /// <returns></returns>
        public ActionResult Delete(int questionid, int id, String name)
        {
            if (Session["uid"] == null || Session["uid"].ToString().Equals(""))
            {
                return RedirectToAction("Index", "Home");
            }
            if ((int)Session["user_type"] < User_Type.POLL_MASTER)
            {
                return RedirectToAction("Invalid", "Home");
            }

            questionModel q = new questionModel(questionid);
            q.deleteQuestion();
            return RedirectToAction("Index", "Question", new { id = id, name = name });
        }