public BillOfExchangeWithCurrentOwnerDto GetBillOfExchangeWithCurrentOwner(int billId) { BillOfExchange bill = billOfExchangeRepository.GetByIds(new[] { billId }).SingleOrDefault(); if (bill is null) { throw new NotFoundException($"Bill with id:{billId} not found"); } ValidateBill(bill); var billWithOwner = mapper.Map <BillOfExchangeWithCurrentOwnerDto>(bill); Party party = partyRepository.GetByIds(new List <int>() { GetCurrentOwner(billWithOwner) }) .SingleOrDefault(); if (party != null) { billWithOwner.OwnerId = party.Id; billWithOwner.OwnerName = party.Name; } return(billWithOwner); }
public IEnumerable <PartyDto> GetByIds(IEnumerable <int> ids) { var list = _repository.GetByIds(new ReadOnlyCollection <int>(new List <int>(ids))).ToList(); return(MapToDto(list)); }