0
I will start by posting my data templates
public class Anuncio
{
public int Id { get; set; }
[Required]
public string Descricao { get; set; }
[Required]
public TipoAnuncio TipoAnuncio { get; set; }
[Required]
public bool Aprovado { get; set; }
[Required]
public DateTime DataPublicacao { get; set; }
[Required]
public virtual ICollection<Imagem> Imagens { get; set; }
[Required]
public int Telefone { get; set; }
[EmailAddress]
public string Email { get; set; }
[Required]
public Pais Pais { get; set; }
[Required]
public Localidade Localidade { get; set; }
public ApplicationUser User { get; set; }
}
public class TipoAnuncio
{
public int Id { get; set; }
[Required]
public string Nome { get; set; }
}
public class TipoAnuncio
{
public int Id { get; set; }
[Required]
public string Nome { get; set; }
}
When I consult the data in the database the data exists what excludes the possibility that the data does not exist even in the database
Where there is trouble? When I consult advertise there are data that are not coming and the data are all coming by means of another table.
How I’m trying to get that data?
var anuncios = await _context.Anuncio.ToListAsync();
If you connected correctly, and have it loaded for example by the method
Include
should appear the relationship data. Now as you have not posted the relations it becomes complicated to say– novic
Exactly this was the problem @Virgilionovic was not using the Include method
– Amadeu Antunes