// // GET: /Tutorials/ public ActionResult Basics() { ViewBag.keywords = "C# tutorial for beginners quick and easy"; List<QuestionModel> questions = new List<QuestionModel>(); if (ModelState.IsValid) { ConnManager connManager = new ConnManager(); questions = connManager.GetQuestions("Select top 190 * from Question order by questionid"); } return View(questions); }
//[Route("")] public ActionResult UnAns(string ddType) { List<QuestionModel> questions = new List<QuestionModel>(); //if (ModelState.IsValid) //{ string strSQL = string.Empty; user = (Users)Session["User"]; long val = 0; if (!string.IsNullOrEmpty(ddType)) { try { val = Convert.ToInt64(ddType); } catch { return View("../Que/UnAns"); } if (user != null && user.UserId == 1) strSQL = "Select * from Question Where QuestionId > 37861 and QuestionTypeId = " + ddType + " order by questionid desc"; else strSQL = "Select top 75 * from Question Where QuestionId > 37861 and QuestionTypeId = " + ddType + " order by questionid desc"; } else { if (user != null && user.UserId == 1) strSQL = "Select * from Question Where QuestionId > 37861 order by questionid desc"; else strSQL = "Select top 75 * from Question Where QuestionId > 37861 order by questionid desc"; } ConnManager connManager = new ConnManager(); questions = connManager.GetQuestions(strSQL); //} ConnManager conn = new ConnManager(); List<QuestionType> items = conn.GetQuestionType(); ViewBag.DDItems = items; return View(questions); }
private List<QuestionModel> GetMyQues(List<QuestionModel> questions) { user = (Users)Session["User"]; if (ModelState.IsValid) { string strSQL = string.Empty; strSQL = "SELECT * FROM VwQuestions WHERE AskedUser = " + user.UserId; ConnManager connManager = new ConnManager(); questions = connManager.GetQuestions(strSQL); } return questions; }