@page "/gestaoprojetos" @attribute [Authorize] @rendermode InteractiveServer @using ConcursoProjetos.Service @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Identity @inject UserManager UserManager @inject AuthenticationStateProvider AuthenticationStateProvider @inject ICandidatoService candidatoService @inject IProjetoService projetoService @inject NavigationManager Navigation Gestão de Projetos

Gestão de Projetos

@if (_projetos == null || !_projetos.Any()) {

@_mensagem

} else { @foreach (var projeto in _projetos) { }
Projeto Unidades Responsável Técnico Status
@projeto.Nome @projeto.NumeroUnidades.ToString() @projeto.ResponsavelTecnicoNomeCompleto
} @code { private Candidato? _candidato; private IEnumerable? _projetos; private string _mensagem = "Loading..."; protected override async Task OnInitializedAsync() { var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); var user = authState.User; if (user.Identity.IsAuthenticated) { var identityUser = await UserManager.GetUserAsync(user); if (identityUser != null) { _candidato = candidatoService.ObterPorUserID(identityUser.Id); _projetos = projetoService.Listar(_candidato!.Id); if (_projetos == null || _projetos.Count() <= 0) _mensagem = "Você não tem projetos cadastrados."; } } } private void EditarProjeto(long projetoId) { // Your logic to add a new project //Console.WriteLine("Adding a new project..."); Navigation.NavigateTo($"/pageprojeto/{projetoId}"); } }