I’m trying to set up some database tables and create some model classes for the subject of Teacher, Student, Courses, Semester. This is for a MVC3 Web App. If I have a userprofile entity and model class. Would it work if I created a classification enum in the userprofile modelclass and that enum would be either Teacher or Student. Idk If this could work. I don’t really know how I can do this b/c I’m going to need the courses that the student is enrolled in and for a teacher, I would need the courses that he/she is teaching and taught. Any advice would be much appreciated.
So for example maybe something like this in the userprofile class:
class UserProfile {
public Guid UserID { get; set; }
public string fname { get; set; }
public string lname { get; set; }
public Classification classification { get; set; }
}
public enum Classification {
Student, Teacher
}
Your design looks good to me.
You could also use a boolean variable, for instance
UserIsPatientorUserIsTeacher, but by using an enumeration you’ve created something that can be easily expanded if your requirements change later – for instance, if you wanted to add student teachers, interns, or whatever.