public Task Get(MessageContext context, GetLoansEvent inputEvent) { var loans = inputEvent.Ids.Select(id => loansRepository.Get(id)) .Where(loan => loan != null).ToArray(); publishingRouter.Publish(context.ReplyTo, new SelectedLoansEvent { Loans = loans }, context.FlowId); return(Task.CompletedTask); }
public override Task <GetLoansResponse> Get(GetLoansRequest request, ServerCallContext context) { var loans = request.Ids.Select(id => loansRepository.Get(id)) .Where(loan => loan != null) .Select(loan => mapper.Map <Loan>(loan)); return(Task.FromResult(new GetLoansResponse { Loans = { loans } })); }
public override async Task <Empty> BatchRepayInstalments(BatchRepayInstalmentsRequest request, ServerCallContext context) { var paymentsToFinish = RepayInstalments(request); if (paymentsToFinish.Any()) { var cancelPaymentsRequest = new CancelPaymentsRequest { Ids = { paymentsToFinish } }; await paymentsClient.CancelAsync(cancelPaymentsRequest, context.RequestHeaders.SelectCustom()); } var repaidInstalments = request.Ids.Select(id => loansRepository.Get(id)).ToArray(); if (repaidInstalments.Length > 0) { projectionChannel.Publish(context.RequestHeaders.GetFlowId(), new DataProjection <Models.Loan, string> { Upsert = repaidInstalments }); } return(new Empty()); }
public ActionResult Edit(int id) { Loan model = _loansRepository.Get(id); return(View(model)); }