// GET: User/Edit/5 public ActionResult Edit(int id) { var model = mapper.Map <EditUserViewModel>(userLogic.GetById(id)); model.SetRoles(userRoleLogic.GetAll().ToList()); return(View(model)); }
public ActionResult UserList(int?pageNumber = 1) { var pagedUsers = _userLogic.GetAll(pageNumber.Value, _pageSize); var allRoles = _userRoleLogic.GetAll().Select(r => r.Name); var userListItems = Mapper.Map <IEnumerable <UserEntity>, IEnumerable <UserListItemVm> >( pagedUsers.Data.Where(u => !string.Equals(u.Name, User.Identity.Name, StringComparison.InvariantCultureIgnoreCase))); var totalPages = (int)Math.Ceiling((double)pagedUsers.Count / _pageSize); var pagedItems = new PagedItems <UserListItemVm> { Data = FillRolesIntoUser(userListItems, allRoles), PageInfo = new PageInfo { CurrentPage = pageNumber.Value, StartIndex = GetStartIndex(pageNumber.Value, totalPages), PageLinksCount = (totalPages < _maxPageSelectors) ? totalPages : _maxPageSelectors, TotalPages = totalPages } }; return(View(pagedItems)); }