コード例 #1
0
        public async Task <TransactionEditDto> GetTransactionForEdit(Abp.Application.Services.Dto.EntityDto <Guid> input)
        {
            var tenantId    = AbpSession.TenantId;
            var transaction = await
                              _transactionRepository.FirstOrDefaultAsync(t => t.Id == input.Id && t.Account.TenantId == tenantId);

            return(transaction.MapTo <TransactionEditDto>());
        }
コード例 #2
0
        /// <summary>
        /// The copy transaction async.
        /// </summary>
        /// <param name="input">
        /// The input.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task CopyTransactionAsync(Abp.Application.Services.Dto.EntityDto <Guid> input)
        {
            var baseTransaction = await this._transactionRepository.FirstOrDefaultAsync(t => t.Id == input.Id);

            var transctionDto = new TransactionEditDto();

            baseTransaction.MapTo(transctionDto);
            transctionDto.Id = null;
            transctionDto.TransactionTime = DateTime.UtcNow;

            await CreateOrUpdateTransaction(transctionDto);
        }
コード例 #3
0
        public async Task DeleteTransaction(Abp.Application.Services.Dto.EntityDto <Guid> input)
        {
            var tenantId    = AbpSession.TenantId;
            var transaction = await _transactionRepository.FirstOrDefaultAsync(t => t.Id == input.Id && t.Account.TenantId == tenantId);

            if (transaction == null)
            {
                throw new AbpAuthorizationException("You are not authorized to perform the requested action");
            }
            await _transactionRepository.DeleteAsync(input.Id);

            await CurrentUnitOfWork.SaveChangesAsync();

            await UpdateTransactionsBalanceInAccountAsync(transaction.AccountId);
        }
コード例 #4
0
        public async Task <Abp.Application.Services.Dto.ListResultDto <TransactionCommentPreviewDto> > GetTransactionComments(Abp.Application.Services.Dto.EntityDto <Guid> input)
        {
            var transctionComments = await _transactionCommentRepository.GetAll()
                                     .Include(c => c.CreatorUser)
                                     .Where(c => c.TransactionId == input.Id)
                                     .OrderBy(c => c.CreationTime)
                                     .AsNoTracking()
                                     .ToListAsync();

            return(new Abp.Application.Services.Dto.ListResultDto <TransactionCommentPreviewDto>(transctionComments.MapTo <List <TransactionCommentPreviewDto> >()));
        }