Example #1
0
        public void TestGetArticleById()
        {
            var result = bll.GetArticleById(1);

            Assert.AreEqual(1, result.ArticleId);
            result = bll.GetArticleById(2);
            Assert.AreEqual(null, result);
        }
Example #2
0
        public IHttpActionResult GetArticleById(int articleid)
        {
            var article = _bll.GetArticleById(articleid);

            if (article == null)
            {
                return(BadRequest());
            }
            return(Ok(article));
        }
Example #3
0
        public IActionResult Get(int id)
        {
            var article = _articleBll.GetArticleById(id);

            if (article == null)
            {
                return(NotFound());
            }

            var articleVm = MapToArticleViewModel(article);

            return(Ok(articleVm));
        }