public void Exchange(Accaunt accBUN, Accaunt accUSD, Accaunt AccRUB, MoneyType type, decimal money) { switch (type) { case MoneyType.BYN: { accBUN.Balance -= money; var m1 = Convert.ToDouble(money) / 2.4; accUSD.Balance += Convert.ToDecimal(m1); } break; case MoneyType.USD: { } break; case MoneyType.RUB: { } break; default: break; } }
static void Main(string[] args) { var bank = new Bank(); bank.Notify += ShowMessage; var client = new Client("Nick", 98.01M); var accountBYN = new Accaunt { id = Guid.NewGuid().ToString(), Type = MoneyType.BYN, Balance = 100.25M }; var accountUSD = new Accaunt { id = Guid.NewGuid().ToString(), Type = MoneyType.USD, Balance = 0.15M }; var accountRUB = new Accaunt { id = Guid.NewGuid().ToString(), Type = MoneyType.RUB, Balance = 4000.50M }; client.accaunts.Add(accountBYN); client.accaunts.Add(accountUSD); client.accaunts.Add(accountRUB); bank.AddNewClient(client); bank.GetClientInfo(client.id); Console.WriteLine(); bank.Exchange(accountBYN, accountUSD, accountRUB, MoneyType.BYN, 98); bank.GetClientInfo(client.id); Console.WriteLine(); //bank.GetClientInfo(client.id); //bank.AddNewClient(client); //bank.GetClientInfo(client.id); //bank.TakeOut(client.id, 98.02M); //bank.TakeOut(client.id, 42M); //bank.GetClientInfo(client.id); Console.ReadKey(); }
public decimal GetBalance(string id) { Accaunt accaunt = accaunts.SingleOrDefault(a => a.id == id); return(accaunt.Balance); }
public void UpdateBalance(string id, decimal money) { Accaunt accaunt = accaunts.SingleOrDefault(a => a.id == id); accaunt.Balance += money; }