public IActionResult Index()
 {
     if (User.Identity.Name == "admin" || User.Identity.Name == "piahag")
     {
         return(View(userLogic.GetUserViewModels()));
     }
     return(RedirectToAction("index", "inventarie"));
 }
        public ActionResult UserLogin([Bind] UserProfileViewModel user)
        {
            var allUsers = userLogic.GetUserViewModels();

            if (allUsers.Any(x => x.UserName.ToLower() == user.UserName))
            {
                if (userLogic.Login(user) == "Inloggad")
                {
                    var userClaims = new List <Claim>()
                    {
                        new Claim(ClaimTypes.Name, user.UserName),
                        new Claim(ClaimTypes.Email, ""),
                    };

                    var grandmaIdentity = new ClaimsIdentity(userClaims, "User Identity");

                    var userPrincipal = new ClaimsPrincipal(new[] { grandmaIdentity });
                    HttpContext.SignInAsync(userPrincipal);

                    return(RedirectToAction("Index", "Home"));
                }
            }

            return(View(user));
        }
 public InventarieController(IInventarieVMLogic _inventarieLogic, IGruppVMLogic _gruppLogic, IEnhetVMLogic _enhetLogic, IUserProfileVMLogic _userLogic)
 {
     userLogic       = _userLogic;
     inventarieLogic = _inventarieLogic;
     gruppLogic      = _gruppLogic;
     enhetLogic      = _enhetLogic;
     enheter         = enhetLogic.GetAllEnheter();
     userList        = userLogic.GetUserViewModels();
     grupper         = gruppLogic.GetAllGrupper();
 }
 public AcountController(IUserProfileVMLogic _userLogic, IGruppVMLogic _gruppLogic)
 {
     gruppLogic      = _gruppLogic;
     userLogic       = _userLogic;
     userProfileList = userLogic.GetUserViewModels();
 }