コード例 #1
0
ファイル: AdminController.cs プロジェクト: kamlys/Game
        public ActionResult AddUser(UserViewModel userModel)
        {
            List<string> errors;
            if (Session["val"] != null)
            {
                errors = ((string[])Session["val"]).ToList();
            }
            else
            {
                errors = new List<string>();
            }

            UserDto _userDto = new UserDto();

            _userDto.Login = userModel.viewModel.User_Login;
            _userDto.Password = userModel.viewModel.Password;
            _userDto.Email = userModel.viewModel.Email;
            //_userDto.Last_Log = userModel.viewModel.LastLog;
            //_userDto.Registration_Date = userModel.viewModel.RegistrationDate;
            //_userDto.Last_Update = userModel.viewModel.LastUpdate;

            if (_userService.Add(_userDto))
            {
                errors.Add("Dodano użytkownika.");
            }
            else
            {
                errors.Add("Błąd. Spróbuj ponownie.");
            }
            Session["val"] = errors.ToArray<string>();

            return RedirectToAction("Admin");
        }
コード例 #2
0
ファイル: AdminController.cs プロジェクト: kamlys/Game
        public ActionResult _UserList()
        {
            UserViewModel userModel = new UserViewModel();

            userModel.listModel = _userService.GetUser().Select(x => new ItemUserViewModel
            {
                ID = x.ID,
                User_Login = x.Login,
                Email = x.Email,
                LastUpdate = x.Last_Update,
                RegistrationDate = x.Registration_Date,
                LastLog = x.Last_Log
            }).ToList();
            return View(userModel);
        }