I have thse two classes. The code works, I can add a Movie to an actor and viceversa. However, on the frontend side I cannot display the Name of the entity I'm adding, I can only display the Id number. If I use a DropDownListFor I can display the names of the actors but I can only save an actor through the Id field. How do I make it so that I display only the actor name and still save it on the database?
public class Movie
{
[Key]
public int Id { get; set; }
public string Title { get; set; }
public int ActorId { get; set; }
[ForeignKey("ActorId")]
public ICollection<Actor> Actors { get; set; }
public int DirectorId { get; set; }
[ForeignKey("DirectorId")]
public Director Director { get; set; }
}
public class Actor
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public int MovieId { get; set; }
[ForeignKey("MovieId")]
public ICollection<Movie> CreditedMovies { get; set; }
}