So In my project have implemented interfaces and AutoMapper, and Identity 2.0 with Id as int modification form here: http://typecastexception.com/post/2014/07/13/ASPNET-Identity-20-Extending-Identity-Models-and-Using-Integer-Keys-Instead-of-Strings.aspx
Question is how to access ApplicationUserManager properties from:
public class EnteredByResolver : ValueResolver<ExcursionVM, int>
{
protected override int ResolveCore(ExcursionVM source)
{
return 1; // TODO - need to access loged user Id to map it to model and save
}
}
In my controller it is easy:
public class ManageController : Controller
{
private ISchedule _ifc;
public ManageController(ISchedule ifc)
{
this._ifc = ifc;
}
private ApplicationUserManager _userManager;
public ApplicationUserManager UserManager
{
get
{
return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
}
private set
{
_userManager = value;
}
}
...
I could access it form interface implementation, but the same (or similar) problem.
Ideas?