public void TestGetArticleById() { var result = bll.GetArticleById(1); Assert.AreEqual(1, result.ArticleId); result = bll.GetArticleById(2); Assert.AreEqual(null, result); }
public IHttpActionResult GetArticleById(int articleid) { var article = _bll.GetArticleById(articleid); if (article == null) { return(BadRequest()); } return(Ok(article)); }
public IActionResult Get(int id) { var article = _articleBll.GetArticleById(id); if (article == null) { return(NotFound()); } var articleVm = MapToArticleViewModel(article); return(Ok(articleVm)); }