Example #1
0
        public void getConsult(Gebruiker gebruiker, int oefeningid)
        {
            Gebruiker lid = _gebruikerRepository.GetByGebruikernaam(gebruiker.Gebruikersnaam);

            if (lid != null)
            {
                lid.AddGebruikerOefening(gebruiker, oefeningid);
                _gebruikerRepository.SaveChanges();
            }
        }
Example #2
0
        public async Task <IActionResult> Aanmelden(string id, Sessie sessie)  //id = gebruikersnaam
        {
            Gebruiker lid = _gebruikerRepository.GetByGebruikernaam(id);

            if (lid == null)
            {
                return(NotFound());
            }
            if (!sessie.Ledenlijst.Any(ls => ls.Lid == lid))
            {
                return(Forbid());
            }
            var user = await _userManager.FindByNameAsync(id);

            await _signInManager.SignOutAsync(); //sign out last person

            await _userManager.AddClaimAsync(user, new Claim(ClaimTypes.Role, "InSessie"));

            await _signInManager.SignInAsync(user, false); //Impersonate User

            return(RedirectToAction("Index", "Graad"));
        }
Example #3
0
 public override void OnActionExecuting(ActionExecutingContext context)
 {
     context.ActionArguments["Gebruiker"] = context.HttpContext.User.Identity.IsAuthenticated ? _gebruikerRepository.GetByGebruikernaam(context.HttpContext.User.Identity.Name) : null;
     base.OnActionExecuting(context);
 }