Esempio n. 1
0
        public async Task <UserProfileProperty> GetUserProfileProperty(int userProfilePropertyId, bool isAdmin)
        {
            using (var uow = new UnitOfWork(Context))
            {
                var repo = new UserProfilePropertyRepository(uow);

                var query = repo.GetAllWithRelated(isAdmin).Where(c => c.UserProfilePropertyId == userProfilePropertyId);

                return(await query.FirstOrDefaultAsync());
            }
        }
Esempio n. 2
0
        private async Task <List <int> > FindUsersFromValue(int profilePropertyId, string profilePropertyName, string value)
        {
            using (var uow = new UnitOfWork(Context))
            {
                var repo = new UserProfilePropertyRepository(uow);

                IQueryable <UserProfileProperty> query;

                if (profilePropertyId == 0)
                {
                    query = repo.GetAllWithRelated(true).Where(c => c.ProfilePropertyName.ToUpper() == profilePropertyName.ToUpper());
                }
                else
                {
                    query = repo.GetAllWithRelated(true).Where(c => c.ProfilePropertyId == profilePropertyId);
                }

                query = query.Where(c => c.Value.ToUpper() == value.ToUpper());

                return(await query.Select(c => c.UserId).ToListAsync());
            }
        }