当前位置: 首页>>代码示例>>C#>>正文


C# IUsersRepository.GetUsers方法代码示例

本文整理汇总了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;
        }
开发者ID:jornfilho,项目名称:services-monitoring,代码行数:7,代码来源:Users.cs

示例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;
        }
开发者ID:jornfilho,项目名称:services-monitoring,代码行数:21,代码来源:User.cs

示例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;
        }
开发者ID:jornfilho,项目名称:services-monitoring,代码行数:22,代码来源:Users.cs

示例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");
        }
开发者ID:jornfilho,项目名称:services-monitoring,代码行数:22,代码来源:User.cs


注:本文中的IUsersRepository.GetUsers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。