예제 #1
0
        public IActionResult AddUsers()
        {
            List <string>    successList  = new List <string>();
            List <UserModel> NewUsersList = HttpContext.Session.Get <List <UserModel> >("NewUsersList") as List <UserModel>;

            if (NewUsersList == null)
            {
                ViewData["info"] = "Failed to add!";
            }
            foreach (var user in NewUsersList)
            {
                string tmp = "";
                tmp = adHelper.CreateUser(user);//Ei toimi koska käyttäjät ovat jo olemassa
                successList.Add($"Username: {user.Username} Email: {user.Email} Password: {user.Password} ----  {tmp}");
            }
            ViewData["info"] = successList;
            return(View("AddMultipleUsers"));
        }
 public IActionResult AdminCreate(UserModel user)
 {
     TempData["Success"] = adHelper.CreateUser(user);
     return(Redirect("UsersList"));
 }