コード例 #1
0
 public ActionResult <IEnumerable <Blog> > Get()
 {
     try
     {
         return(Ok(_bs.Get()));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #2
0
        public ActionResult GetBlogById(string id)
        {
            var blog = _blogsService.Get(id);

            if (blog == null)
            {
                return(NotFound(new Response <string>(new BlogIdError())
                {
                    resultBody = ""
                }));
            }

            return(Ok(new Response <Blog>(new Ok())
            {
                resultBody = blog
            }));
        }
コード例 #3
0
 public ActionResult <IEnumerable <Blog> > Get()
 {
     try
     {
         return(Ok(_blogsService.Get()));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err));
     }
 }