public async Task <IEnumerable <GetCommentByCardIdResponseDTO> > GetCommentByCardId(GetCommentByCardIdRequestDTO getCommentByCardIdRequestDTO)
 {
     try
     {
         return(await _unitOfWokDapper.CommentQueries.GetCommentByCardId(getCommentByCardIdRequestDTO));
     }
     catch (Exception ex)
     {
         _logger.LogExceptionError(ex.ToString());
         throw ex;
     }
 }
Beispiel #2
0
 public async Task <IEnumerable <GetCommentByCardIdResponseDTO> > GetCommentByCardId(GetCommentByCardIdRequestDTO getCommentByCardIdRequestDTO)
 {
     return(await _commentService.GetCommentByCardId(getCommentByCardIdRequestDTO));
 }
        public async Task <IEnumerable <GetCommentByCardIdResponseDTO> > GetCommentByCardId(GetCommentByCardIdRequestDTO getCommentByCardIdRequestDTO)
        {
            var query = @$ "
            SELECT C.*, A.*, CA.* 
            FROM Comment C
            INNER JOIN Account A 
            ON C.UserId = A.AccountId
            INNER JOIN Card CA
            ON C.CardId = CA.CardId
            WHERE C.CardId = @CardId
            AND C.IsActive = @IsActive";

            DynamicParameters param = new DynamicParameters();

            param.Add("@CardId", getCommentByCardIdRequestDTO.CardId);
            param.Add("@IsActive", true);

            return(await _db.QueryAsync <GetCommentByCardIdResponseDTO>(sql : query, param : param, commandType : CommandType.Text));
        }