Child Entity not getting added or updated while updating the parent entity

Joined
Oct 31, 2021
Messages
9
Programming Experience
Beginner
For example, we have a car and it is the Parent class of Models so cars can have many models possible so while updating the car with models car is getting updated but models are not getting added or modified in Entity Framework .

car:
public class Car{
    public string name{get;set;}
    public name{get;set;}
    public virtual Model Model{ get; set; }

}

public class Model{
     [Key]
     [ForeignKey(nameof(Guardian))]
    public int Id
    public virtual Car Car{ get; set; }
    public string Name{get;set;}
    public string Name{get;set;}
    
}
 
Top Bottom