Пример #1
0
        public IEnumerable <EndorsementDto> GetEndorsementsForBill(int billId)
        {
            List <EndorsementDto> endorsements =
                (from party in partyRepository.Get(int.MaxValue, 0)
                 join endorsement in endorsementRepository.Get(int.MaxValue, 0) on party.Id equals endorsement
                 .NewBeneficiaryId
                 where endorsement.BillId == billId
                 select new EndorsementDto
            {
                NewBeneficiaryId = party.Id,
                NewBeneficiary = party.Name,
                Id = endorsement.Id,
                BillId = endorsement.BillId,
                PreviousEndorsementId = endorsement.PreviousEndorsementId
            }).ToList();

            if (!endorsements.Any())
            {
                return(new List <EndorsementDto>());
            }

            BillOfExchange bill = billOfExchangeRepository.GetByIds(new List <int> {
                billId
            }).Single();

            ValidateEndorsements(billId, endorsements, bill);

            return(endorsements);
        }
Пример #2
0
        public PagedResultDto <PartyDto> GetList(PagedRequestDto request)
        {
            var list = _repository.Get(request.Take, request.Skip).ToList();

            var result = new PagedResultDto <PartyDto>();

            if (list.Any())
            {
                result.Data = MapToDto(list);
            }

            return(result);
        }
Пример #3
0
        private async Task <bool> JoinPartyAsync(Guid partyId, PartyGoer attendee)
        {
            try
            {
                Party party = _partyRepository.Get(partyId);

                party.JoinParty(attendee);

                _partyRepository.Update(party);

                return(true);
            }
            catch (Exception ex)
            {
                await _logService.LogExceptionAsync(ex, "Error occurred in JoinPartyAsync");

                return(false);
            }
        }
Пример #4
0
        public void DeleteParty(long id)
        {
            var party = _partyRepository.Get(id);

            if (party == null)
            {
            }

            using (var transaction = _partyRepository.unitOfWork._firstGenUnitOfWork.Database.BeginTransaction())
            {
                var tr = transaction.GetDbTransaction();

                _partyRepository.unitOfWork._secondGenUnitOfWork.Database.UseTransaction(tr);
                _partyRepository.unitOfWork._thirdGenUnitOfWork.Database.UseTransaction(tr);

                _partyRepository.Remove(party);

                transaction.Commit();
            }
        }
Пример #5
0
        public Party GetParty(int id)
        {
            var data = _partyRepository.Get(id);

            return(data);
        }