public static User ToModel(this ManageOverviewUsersModel users) { return(new User() { Id = users.Id, Username = users.Username, IsAdmin = users.IsAdmin }); }
public IActionResult ManageOverview(string successMessage, string errorMessage) { ViewBag.SuccessMessage = successMessage; ViewBag.ErrorMessage = errorMessage; var id = int.Parse(User.FindFirst("Id").Value); var users = _usersService.GetAllUsers(); var usersToModify = users.Where(x => x.Id != id); var modelUsers = new List <ManageOverviewUsersModel>(); foreach (var item in usersToModify) { ManageOverviewUsersModel user = item.ToManageOverviewUsersModel(); modelUsers.Add(user); } return(View(modelUsers)); }