Example #1
0
 public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
 {
     if (controllerContext.HttpContext.User.Identity.IsAuthenticated)
     {
         IGebruikerRepository repos = (IGebruikerRepository)DependencyResolver.Current.GetService(typeof(IGebruikerRepository));
         // return repos.FindBy("1000000000");
         return(repos.FindByEmail(controllerContext.HttpContext.User.Identity.Name));
     }
     return(null);
 }
Example #2
0
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            if (controllerContext.HttpContext.User.Identity.IsAuthenticated)
            {
                IGebruikerRepository   repos       = (IGebruikerRepository)DependencyResolver.Current.GetService(typeof(IGebruikerRepository));
                ApplicationUserManager userManager = controllerContext.HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>();
                ApplicationUser        appUser     = userManager.FindByNameAsync(controllerContext.HttpContext.User.Identity.Name).Result;

                if (appUser != null)
                {
                    Gebruiker g = repos.FindByEmail(appUser.Email);
                    return(g);
                }
                return(null);
            }
            return(null);
        }