I have two tables like this:
public partial class Major
{
public int Id { get; set; }
[Required]
public string Name { get; set; }
public ICollection<Salon> Salons { get; set; }
}
public class Salon
{
public int Id { set; get; }
public string Title { set; get; }
public ICollection<Salon> Salons { get; set; }
}
In the table Major
, I have data like this:
Id Name
-----------------
1 basketball
2 vollyball
and my problem is when I am adding a new record to the Salon
table with related data of basketball
and volleyball
; these two records have been added as new records to the Major
table when they already existed...