//public string AddCustomer(NewCustomerVm customerVm) //{ // var customer = _mapper.Map<Customer>(customerVm); // customer.IsActive = true; // var id = _customerRepo.AddCustomer(customer); // return id; //} //public int AddEmailToCustomer(int customerId, ContactDetailListVm contactInformation) //{ // throw new NotImplementedException(); //} //public int AddPhoneNumberToCustomer(int customerId, ContactDetailListVm contactInformation) //{ // throw new NotImplementedException(); //} public ListUserForListVm GetAllUsersForList() { var users = _userRepo.GetAllUsers().ProjectTo <UserForListVm>(_mapper.ConfigurationProvider).ToList(); var userList = new ListUserForListVm() { Users = users, Count = users.Count }; return(userList); }
public ListUserForListVm GetAllUsersForList(int pageSize, int pageNo, string searchString) { var users = _userRepo.GetAllUsers().Where(p => p.Email.Contains(searchString)); var usersToShow = users.Skip(pageSize * (pageNo - 1)).Take(pageSize).ToList(); var result = new ListUserForListVm() { PageSize = pageSize, CurrentPage = pageNo, SearchString = searchString, Users = new List <UserForListVm>(), Count = users.Count() }; foreach (var item in usersToShow) { result.Users.Add(CreateUserView(item)); } return(result); }
public ListUserForListVm GetAllInActiveUsersForList(int pageSize, int pageNo, string searchString) { var Users = _userRepo.GetAllDeactivatedUsers().Where(p => p.UserName.Contains(searchString)); var UsersToShow = Users.Skip(pageSize * (pageNo - 1)).Take(pageSize).ToList(); var result = new ListUserForListVm() { PageSize = pageSize, CurrentPage = pageNo, SearchString = searchString, Users = new List <UserForListVm>(), Count = Users.Count() }; foreach (var item in UsersToShow) { var custVm = CreateUserView(item); result.Users.Add(custVm); } return(result); }