I'm new to web development. Now I learn ASP.NET MVC 5 with ASP.NET Identity. Can you give me some advices in my situation:
In my site I want to have some types of users. For example: Buyer Seller
Each of them can login and control his part of information.(e.g. Buyer can change his info, add requests. Seller also can change his own info and add goods)
Now, i create something like that:
using Microsoft.AspNet.Identity.EntityFramework;
using System.Data.Entity;
public class ApplicationUser : IdentityUser
{
public int? BuyerId { get; set; }
public int? SellerId { get; set; }
public virtual Buyer Buyer { get; set; }
public virtual Seller Seller { get; set; }
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection")
{
}
...
}
When we create a user he get some role and property with information(e.g. if it's buyer he will have role "Buyer" and some Buyer property(and Seller will be null).
Is it a normal approach?
UPDATE:
I think I picked a bad example(with Seller and Buyer). In my case I have something like recomendation system(another example):
- First Type of User, who can add info about himself and find some ITEMS(e.g. Fruits)
- Second Type of User, who add this ITEMS(with additional information) (e.g. apple, pear ,Grapes. Other(second type of user) add vegetables)
- Last type of User, who can add some additional information(e.g Cities)
The system can determine the user's preferences (some vegetables or fruit) on the basis of additional information about the user(e.g. recent experience and etc) and items(e.g. kind, cost and etc)