public IActionResult Details(int id)
 {
     try
     {
         var question = _questionsService.GetQuestionById(id);
         return(View(question));
     }
     catch (Exception)
     {
         return(NotFound());
     }
 }
Пример #2
0
 public IActionResult GetQuestionById(int questionId)
 {
     try
     {
         var question = _questionsService.GetQuestionById(questionId);
         return(Ok(question));
     }
     catch (Exception)
     {
         return(NotFound());
     }
 }
 public ActionResult <Question> Get(string id)
 {
     try
     {
         Question question = _qs.GetQuestionById(id);
         return(Ok(question));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
        public IActionResult Details(int id)
        {
            var question = _service.GetQuestionById(id);

            if (question == null)
            {
                return(NotFound());
            }
            var qResponses   = _service.GetRelatedResponses(id);
            var viewQuestion = new QuestionForView
            {
                Id         = question.Id,
                Title      = question.Title,
                Body       = question.Body,
                UserId     = question.UserId,
                Popularity = question.Popularity,
                Responses  = qResponses
            };

            return(View(viewQuestion));
        }
Пример #5
0
        // GET: Questions/Details/5
        public IActionResult Details(Guid id)
        {
            var question = _service.GetQuestionById(id);

            return(View(question));
        }