public IActionResult Deposit(DepositViewModel model) { if (ModelState.IsValid) { var command = new DepositCommand() { AccountId = model.AccountId, Amount = model.Amount }; var query = new DepositHandler().Handler(command); if (query.IsCompletedSuccessfully) { TempData["Success"] = $"{model.Amount.ToString("C")} deposited to account"; return(View()); } else { TempData["Error"] = $"Deposit failed"; return(View()); } } else { return(NotFound()); } }
private static FakeBus StickABusInIt(IPersistentStore store) { var bus = new FakeBus(); var depositDetector = new DepositDetector(new Repository<LabelDepositJob>(new EventStore(bus))); bus.RegisterHandler<FileDeposit>(depositDetector.Handle); var depositHandler = new DepositHandler(store); bus.RegisterHandler<DepositDetected>(depositHandler.Handle); return bus; }
private static FakeBus StickABusInIt(IPersistentStore store) { var bus = new FakeBus(); var depositDetector = new DepositDetector(new Repository <LabelDepositJob>(new EventStore(bus))); bus.RegisterHandler <FileDeposit>(depositDetector.Handle); var depositHandler = new DepositHandler(store); bus.RegisterHandler <DepositDetected>(depositHandler.Handle); return(bus); }