I am quite new to MVC, I have created Model, View and a Controller for the following Model
public class Student:Basic
{
public Guid StudentId { get; set; }
public string Name { get; set; }
[ForeignKey("SchoolClass")]
public virtual Guid StudentClassId { get; set; }
public virtual SchoolClass SchoolClass { get; set; }
}
Here in the View I wanted to have a DropDownList for Class. But I am not sure how can I achieve it without using View-Model. Many solutions ask me to create a View-Model with SelectList for Class and populate the Class (get all class in DB) in Controller then use this in View. Is this the only option here? Or can we populate the DropDown with any other way?