public ServiceResponse ManageUser(List<LU_Role> listRole) { ServiceResponse response = new ServiceResponse { IsSuccess = false }; UserSearchModel searchModel = new UserSearchModel(); try { searchModel.ListOfRole = listRole; response.IsSuccess = true; response.Data = searchModel; } catch (Exception) { response.IsSuccess = false; response.ErrorCode = Constants.ErrorCode_InternalError; response.Message = Resource.ExceptionMessage; } return response; }
public ServiceResponse GetUserList(UserSearchModel searchParams, int pageSize, int pageIndex, string sortIndex, string sortDirection) { ServiceResponse response = new ServiceResponse(); try { List<SearchValueData> searchList = new List<SearchValueData>() { new SearchValueData { Name = "FromIndex", Value = Convert.ToString(((pageIndex - 1) * pageSize) + 1) }, new SearchValueData { Name = "ToIndex", Value = Convert.ToString(pageIndex * pageSize) }, new SearchValueData{ Name = "SortExpression",Value = string.IsNullOrEmpty(sortIndex) ? "CreatedDate" : Convert.ToString(sortIndex)}, new SearchValueData{ Name = "SortType",Value = string.IsNullOrEmpty(sortDirection) ? "DESC" : Convert.ToString(sortDirection)}, new SearchValueData{ Name = "Email",Value = Convert.ToString(searchParams.Email)}, new SearchValueData{ Name = "Name",Value = Convert.ToString(searchParams.Name)}, new SearchValueData{ Name = "RoleID",Value = Convert.ToString(searchParams.RoleID)} }; List<UserViewModel> totalData = GetEntityList<UserViewModel>("GetUserList", searchList); int count = 0; if (totalData != null && totalData.Count > 0) count = totalData.First().Count; Page<UserViewModel> users = GetPageInStoredProcResultSet(pageIndex, pageSize, count, totalData); response.Data = users; response.IsSuccess = true; } catch (Exception) { response.IsSuccess = false; response.Message = Resource.ExceptionMessage; } return response; }