Esempio n. 1
0
        public ActionResult DeleteConfirm(ModelUser model)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Delete", "Admin"));
            }
            List <ModelUserRole> UR = _userRoleStore.GetUserRolesByUser(model.Username).ToList();

            HelpingClass.FEach(UR, x => _userRoleStore.DeleteUserRole(x));
            _userStore.DeleteUser(model);
            return(RedirectToAction("Delete", "Admin"));;
        }
Esempio n. 2
0
        public ActionResult FilterUserType(string username)
        {
            IQueryable <ModelUserRole> model = _userRoleStore.GetUserRolesByUser(username);

            if (model.Any(x => x.RoleName == "admin"))
            {
                return(RedirectToAction("Index", "Admin"));
            }
            else if (model.Any(x => x.RoleName == "student"))
            {
                return(RedirectToAction("Index", "Student"));
            }
            return(RedirectToAction("Index"));
        }