public ActionResult AddIgnored(IgnoredViewModel ignoredModel) { List<string> errors; if (Session["val"] != null) { errors = ((string[])Session["val"]).ToList(); } else { errors = new List<string>(); } IgnoredDto ignoredDto = new IgnoredDto(); ignoredDto.Ignored_Login = ignoredModel.viewModel.Ignored_Login; ignoredDto.User_Login = ignoredModel.viewModel.User_Login; if(_userService.AddIgnoredAdmin(ignoredDto)) { errors.Add("Dodano ignorowanych."); } else { errors.Add("Błąd. Spróbuj ponownie."); } Session["val"] = errors.ToArray<string>(); return RedirectToAction("Admin"); }
public ActionResult _IgnoredList() { IgnoredViewModel ignoredModel = new IgnoredViewModel(); ignoredModel.listModel = _userService.GetIgnored().Select(x => new ItemIgnoredViewModel { ID = x.ID, Ignored_ID = x.Ignored_ID, Ignored_Login = x.Ignored_Login, User_ID = x.User_ID, User_Login = x.User_Login }).ToList(); ignoredModel.allUser = _userService.GetUser().Select(x => x.Login).ToArray(); return View(ignoredModel); }