Exemple #1
0
        public override async Task <GetUserQuery.Result> ExecuteAsync(
            GetUserQuery query, CancellationToken cancellationToken = default(CancellationToken))
        {
            var user = await _dataSession.Set <User>()
                       .Include(u => u.UserRoles)
                       .ThenInclude(ur => ur.Role)
                       .FirstAsync(u => u.UserId == query.UserId);

            var roles = await _dataSession.Set <Role>()
                        .ToListAsync();

            return(new GetUserQuery.Result(user, roles));
        }
 public UserForgotPasswordService(IDataSession dataSession)
 {
     _db = dataSession;
     _userForgotPassword = _db.Set <UserForgotPassword>();
 }
 public virtual void Delete(TEntity entity)
 {
     _dataSession.Set <TEntity>().Remove(entity);
 }
Exemple #4
0
        /// <summary>
        /// Получает дерево выражений для сущности типа <typeparamref name="T"/>.
        /// </summary>
        /// <returns>Дерево выражений сущности.</returns>
        public IQueryable <T> All()
        {
            var result = _dataSession.Set <T>().Where(c => true);

            return(result);
        }