I'm trying to make the relationship between two "Tables" classes.
I'm building an API for MVC5 EF6 in Visual Studio, but I need an information from one class to appear in the other.
public class ASSOCIADO
{
public string ID_EMPRESA { get; set; }
*public ICollection<EMPRESA> NM_FANTASIA_EMPRESA { get; set; }
[Key]
public string ID_ASSOCIADO { get; set; }
public string NM_ASSOCIADO { get; set; }
public string NR_CPF { get; set; }
public string DS_EMAIL { get; set; }
public DateTime? DT_NASCIMENTO { get; set; }
public DateTime? DT_INATIVACAO { get; set; }
*public virtual EMPRESA NM_FANSTASIA_EMPRESA { get; set; }
}
In this code above, I have the information of the associate and I have the CD_EMPRESA (KEY in the Company Class), the codes with * have been some attempts found in the internet to bring these values.
In another class I have this code:
public class EMPRESA
{
[Key]
public string ID_EMPRESA { get; set; }
public string NM_FANTASIA_EMPRESA { get; set; }
}
I need to show NM_FANTASIA_EMPRESA in the ASSOCIATE class, so that according to the ID_EMPRESA of it.