internal static void Handle(DbContext dbContext, OnAtmCreatedEventArgs args) { var atmDTO = new AtmDTO { Id = ((Shared.Identity)args.Atm.Id).Id, CashBalance = args.Atm.CashBalance, BankId = ((Shared.Identity)args.BankId).Id }; dbContext.Atms.Add(atmDTO); dbContext.SaveChanges(); }
internal static void Handle(DbContext dbContext, OnCashBalanceChangedEventArgs args) { var atmDTO = new AtmDTO { Id = ((Shared.Identity)args.Atm.Id).Id, }; dbContext.Atms.Attach(atmDTO); atmDTO.CashBalance = args.Atm.CashBalance; dbContext.SaveChanges(); }