I have 2 types of user:
public abstract class User
{
public Guid Id { get; set; }
public string PhoneNumber { get; set; }
public string Password { get; set; }
}
public class Customer : User
{
public string Nickname { get; set; }
}
public class Vendor : User
{
public List<int> PriceList { get; set; }
}
I would like to have an api path like : /api/user/login :
[HttpPost("login")]
public ActionResult</* MyUser */> Login(...)
{
...
}
Is there a way to create only one method returning my different types ?
If no, what would be the best architecture ?
- Two routes:
/api/customer/loginand/api/vendor/login - Two routes:
/api/user/customer/loginand/api/user/vendor/login - One route:
/api/user/loginwith an enum in the request telling which user to use
Thank you for your help !