/// <summary> /// Gets the user service /// </summary> /// <returns></returns> private IUserService GetUserService() { IAccountProvider accountProvider = new AspNetAccountProvider( HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>(), HttpContext.GetOwinContext().Authentication); IUserService userService = UserTypeFactory.GetUserService(new UserServiceUoW(User.Identity.GetUserId(), accountProvider)); return(userService); }
// GET: Users public ActionResult Index() { Mapper.CreateMap <ApplicationUser, UserViewModel>(); IAccountProvider accountProvider = new AspNetAccountProvider( HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>(), HttpContext.GetOwinContext().Authentication); IUserService userService = UserTypeFactory.GetUserService(new UserServiceUoW(User.Identity.GetUserId(), accountProvider)); IList <UserViewModel> listOfUsers = Mapper.Map <IList <ApplicationUser>, IList <UserViewModel> >( userService.GetUsers().ToList()); UserListViewModel userListViewModel = new UserListViewModel { Users = listOfUsers }; userService.UpdateUserTenants(); return(View(userListViewModel)); }