本文整理汇总了C#中IUsersRepository.GetUsers方法的典型用法代码示例。如果您正苦于以下问题:C# IUsersRepository.GetUsers方法的具体用法?C# IUsersRepository.GetUsers怎么用?C# IUsersRepository.GetUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUsersRepository
的用法示例。
在下文中一共展示了IUsersRepository.GetUsers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUsersAll
public IList<User> GetUsersAll(UserFilter filterData, IUsersRepository repository)
{
ValidateRepositoryInstance(repository);
var users = repository.GetUsers(filterData, int.MaxValue, 0);
return users;
}
示例2: Get
public User Get(UserFilter filterData, IUsersRepository repository)
{
ValidateRepositoryInstance(repository);
this.CleanModel();
var users = repository.GetUsers(filterData, 1, 0);
if (users == null || !users.Any())
return this;
var user = users.FirstOrDefault();
if (user == null)
return this;
this.Id = user.Id;
this.Name = user.Name;
this.Email = user.Email;
this.ServicesList = user.ServicesList;
this.Status = user.Status;
return this;
}
示例3: GetUsersPaginated
public Users GetUsersPaginated(UserFilter filterData, Pagination pagination, IUsersRepository repository)
{
ValidateRepositoryInstance(repository);
if(pagination == null)
pagination = new Pagination().SetRequestData(int.MaxValue, 0);
this.Pagination = pagination;
var usersCount = repository.GetUsersCount(filterData);
this.Pagination.SetResponseData(0);
if (usersCount == 0)
{
this.Pagination.SetResponseData(0);
return this;
}
var users = repository.GetUsers(filterData, pagination.PageSize, this.Pagination.CurrentPage * this.Pagination.PageSize);
this.UsersList = users;
return this;
}
示例4: ValidateExistentEmail
private void ValidateExistentEmail(IUsersRepository repository)
{
var filter = new UserFilter().SetEmail(this.Email);
if (string.IsNullOrEmpty(this.Id))
{
var count = repository.GetUsersCount(filter);
if(count > 0)
throw new ArgumentException("There is another user with the same email");
return;
}
var users = repository.GetUsers(filter, 2, 0);
if (users == null || !users.Any())
return;
if (users.All(u => u.Id == this.Id))
return;
throw new ArgumentException("There is another user with the same email");
}