예제 #1
0
        public IActionResult GetHomePage()
        {
            Blog   defaultBlog  = PlatformConfigutationService.GetDefaultBlog();
            string platformName = PlatformConfigutationService.GetPlaformName();

            if (defaultBlog == null)
            {
                IEnumerable <Blog> blogList = BlogService.GetAllBlogs();
                return(Ok(new HomePageResponse(platformName, blogList)));
            }
            else
            {
                return(Ok(new HomePageResponse(platformName, defaultBlog)));
            }
        }
예제 #2
0
 public IActionResult GetDefaultBlog()
 {
     try
     {
         Blog defaultBlog = PlatformConfigutationService.GetDefaultBlog();
         return(Ok(defaultBlog));
     }
     catch (BlogNotFoundException exception)
     {
         return(HandleUnexpectedException(exception, "Inconsistent state: there is a default blog ID set, but the blog could not be found!"));
     }
     catch (Exception exception)
     {
         return(HandleUnexpectedException(exception));
     }
 }