I'm creating an ASP.Net MVC 5 application. In my website, 3 different types of users exist.
- Admin
- Normal users
- Restaurants
Each of these users have its own capabilities and access rights. Meaning, the view for each of them should be different.
I have created the models for both of the normal and restaurant. I was wondering how I can modify my existing structure to support this functionality.
public class User : IUser
{
public User()
: this(String.Empty)
{
}
public User(string userName)
{
UserName = userName;
Id = Guid.NewGuid().ToString();
}
[Key]
public string Id { get; set; }
[Required]
public string UserName { get; set; }
[Required]
public string FirstName { get; set; }
[Required]
public string LastName { get; set; }
public string Phone { get; set; }
public string MobilePhone { get; set; }
[Required]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
public virtual IList<UserAddress> Addresses { get; set; }
}
public class Restaurant
{
[Key]
public int ID { get; set; }
[Required]
public string Name { get; set; }
public virtual IList<RestaurantAddress> Addresses { get; set; }
public virtual IList<RestaurantFood> Menu { get; set; }
public virtual IList<Review> Reviews { get; set; }
[DataType(DataType.Url)]
public string Website { get; set; }
[DataType(DataType.PhoneNumber)]
public string Phone { get; set; }
[DataType(DataType.PhoneNumber)]
public string Fax { get; set; }
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
public int Seats { get; set; }
public double AverageRating { get; set; }
public double AveragePrice { get; set; }
}