Exemplo n.º 1
0
        public async Task <IActionResult> GetAllPostsByAuthor(string author)
        {
            try
            {
                var allPosts = await _postServices.GetAllPostsByAuthor(author);

                if (allPosts != null)
                {
                    return(Ok(allPosts));
                }
                return(BadRequest("Sorry!, No Data was fetched, Please try again"));
            }
            catch (Exception ex)
            {
                return(BadRequest($"{ex.Message}, Error! Your task failed, Please try again"));
            }
        }