From 2d901708b87f0a0d190734ba8ab79ad1874ef6cc Mon Sep 17 00:00:00 2001 From: Ricardo Carneiro Date: Sun, 24 Aug 2025 12:16:51 -0300 Subject: [PATCH] fix: erro de categoria e falta de uma pagina de erro. --- src/BCards.Web/Controllers/HomeController.cs | 21 ++++++---------- src/BCards.Web/Views/Shared/Error.cshtml | 26 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 src/BCards.Web/Views/Shared/Error.cshtml diff --git a/src/BCards.Web/Controllers/HomeController.cs b/src/BCards.Web/Controllers/HomeController.cs index 563a3e5..52ff107 100644 --- a/src/BCards.Web/Controllers/HomeController.cs +++ b/src/BCards.Web/Controllers/HomeController.cs @@ -36,22 +36,17 @@ public class HomeController : Controller return View(); } - [Route("categoria/{categorySlug}")] - public async Task Category(string categorySlug) + [Route("health")] + public IActionResult Health() { - ViewBag.IsHomePage = true; - var category = await _categoryService.GetCategoryBySlugAsync(categorySlug); - if (category == null) - return NotFound(); - - var pages = await _userPageService.GetPagesByCategoryAsync(categorySlug, 20); - - ViewBag.Category = category; - ViewBag.Pages = pages; - - return View(); + return Ok(new { + status = "healthy", + timestamp = DateTime.UtcNow, + version = "1.0.0" + }); } + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { diff --git a/src/BCards.Web/Views/Shared/Error.cshtml b/src/BCards.Web/Views/Shared/Error.cshtml new file mode 100644 index 0000000..ffef43f --- /dev/null +++ b/src/BCards.Web/Views/Shared/Error.cshtml @@ -0,0 +1,26 @@ +@{ + ViewData["Title"] = "Erro"; +} + + + + + + + Erro - BCards + + + +
+
+
+
+

Oops! Algo deu errado.

+

Ocorreu um erro inesperado. Por favor, tente novamente.

+ Voltar ao InĂ­cio +
+
+
+
+ + \ No newline at end of file