Beispiel #1
0
        //Display details about selected question
        public ActionResult DisplayQuestionDetails(int question_id)
        {
            GetJSON getJSON           = new GetJSON();
            String  answerQueryFormat = String.Format(getSelectedObject_URL, question_id);
            SOModel model             = getJSON.GetStackoverflowJsonObject(answerQueryFormat);
            Item    selectedItem      = model.items.FirstOrDefault(so => so.question_id == question_id);

            if (selectedItem == null)
            {
                return(HttpNotFound());
            }
            return(View(selectedItem));
        }
Beispiel #2
0
        public ActionResult GetAnswers(int question_id)
        {
            GetJSON getJSON           = new GetJSON();
            String  answerQueryFormat = String.Format(getAnswer_URL, question_id);
            SOModel result            = getJSON.GetStackoverflowJsonObject(answerQueryFormat);
            Item    selectedItem      = result.items.FirstOrDefault(so => so.question_id == question_id);

            if (selectedItem == null)
            {
                return(HttpNotFound());
            }
            return(PartialView("~/Views/StackOverflow/StackOverflow_PartialViews/StackOverflow_Answers.cshtml", selectedItem));
        }
Beispiel #3
0
 // GET: StackOverflow
 //Display all Stackoverflow data
 public ActionResult Index()
 {
     try
     {
         GetJSON getJSON = new GetJSON();
         SOModel model   = getJSON.GetStackoverflowJsonObject(getJSON_URL); //URL might not be accessible
         return(View(model));
     }
     catch (Exception)
     {
         return(HttpNotFound("No response received from the server"));
     }
 }