I have 3 types of user in my application(in asp.net mvc-5): Admin, Doctor and User. In Models folder I've created 3 other folder, one for each type of user. Should I create a single ViewModel, suppose DoctorViewModel which will carry all information about doctor? Or should I create DoctorLoginViewModel and DoctorRegistractionViewModel and so on?
N.B: I have separate tables in database for credentials(email and pass) and for personal Information(age, dob, gender etc).
You can simply use one model User which will carry out all common properties with those 3 types.
public class User
{
public string Name { get; set; }
public string LastName { get; set; }
public UseType Type { get; set; }
}
public enum UserType
{
User = 1,
Doctor = 2,
Admin = 3
}
And then if you want have separate views for each of the users, then you can create DoctorViewModel or UserViewModel as needed.
I would suggest you to read about Role based auhtorization in asp.net mvc.