fix: logar erro
All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 2s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Successful in 16m11s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Successful in 2m23s
BCards Deployment Pipeline / Deploy to Staging (x86 - Local) (push) Has been skipped
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s
All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 2s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Successful in 16m11s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Successful in 2m23s
BCards Deployment Pipeline / Deploy to Staging (x86 - Local) (push) Has been skipped
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s
This commit is contained in:
parent
f98dac9178
commit
4bad39ec85
@ -137,6 +137,8 @@ public class AdminController : Controller
|
||||
[HttpGet]
|
||||
[Route("ManagePage")]
|
||||
public async Task<IActionResult> ManagePage(string id = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
ViewBag.IsHomePage = false;
|
||||
|
||||
@ -144,6 +146,7 @@ public class AdminController : Controller
|
||||
if (user == null)
|
||||
return RedirectToAction("Login", "Auth");
|
||||
|
||||
|
||||
var userPlanType = Enum.TryParse<PlanType>(user.CurrentPlan, true, out var planType) ? planType : PlanType.Trial;
|
||||
var categories = await _categoryService.GetAllCategoriesAsync();
|
||||
var themes = await _themeService.GetAvailableThemesAsync();
|
||||
@ -183,6 +186,13 @@ public class AdminController : Controller
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in ManagePage GET");
|
||||
TempData["Error"] = "Ocorreu um erro ao carregar a página. Tente novamente.";
|
||||
throw new Exception("Erro ao salvar o bcard", ex);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("ManagePage")]
|
||||
@ -190,12 +200,18 @@ public class AdminController : Controller
|
||||
[RequestFormLimits(MultipartBodyLengthLimit = 5 * 1024 * 1024)]
|
||||
public async Task<IActionResult> ManagePage(ManagePageViewModel model)
|
||||
{
|
||||
string userId = "";
|
||||
try
|
||||
{
|
||||
|
||||
ViewBag.IsHomePage = false;
|
||||
|
||||
var user = await _authService.GetCurrentUserAsync(User);
|
||||
if (user == null)
|
||||
return RedirectToAction("Login", "Auth");
|
||||
|
||||
userId = user.Id;
|
||||
|
||||
// Limpar campos de redes sociais que são apenas espaços (tratados como vazios)
|
||||
CleanSocialMediaFields(model);
|
||||
|
||||
@ -231,7 +247,7 @@ public class AdminController : Controller
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error uploading profile image");
|
||||
_logger.LogError(ex, $"Userid: {userId} - Error uploading profile image");
|
||||
ModelState.AddModelError("ProfileImageFile", "Erro ao fazer upload da imagem. Tente novamente.");
|
||||
TempData["ImageError"] = "Erro ao processar a imagem. Verifique o formato e tamanho.";
|
||||
|
||||
@ -319,7 +335,7 @@ public class AdminController : Controller
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error creating page");
|
||||
_logger.LogError(ex, $"Userid: {userId} - Error creating page");
|
||||
ModelState.AddModelError("", "Erro ao criar página. Tente novamente.");
|
||||
model.AvailableCategories = await _categoryService.GetAllCategoriesAsync();
|
||||
model.AvailableThemes = await _themeService.GetAvailableThemesAsync();
|
||||
@ -382,6 +398,13 @@ public class AdminController : Controller
|
||||
|
||||
return RedirectToAction("Dashboard");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, $"Userid: {userId} - Error in ManagePage GET");
|
||||
TempData["Error"] = "Ocorreu um erro ao carregar a página. Tente novamente.";
|
||||
throw new Exception("Erro ao salvar o bcard", ex);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("CreatePage")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user