removed dotnet 6

This commit is contained in:
Geir Okkenhaug Jerstad 2024-12-03 13:40:12 +01:00
parent 33328cee26
commit 7616efbf77
8 changed files with 48 additions and 13 deletions

View file

@ -29,6 +29,15 @@ namespace BankAppMarie
{
_savingsAccount = isSavingsAccount;
_accountName = accountName;
_balance = 10000;
_accountTransactions = new List<string>();
_accountNumber = new Guid().ToString();
}
public void AddNewTransaction(string transactionText)
{
_accountTransactions.Add(transactionText);
Console.WriteLine("Added: " + transactionText);
}
public int GetAccountBalance()

View file

@ -47,6 +47,7 @@ namespace BankAppMarie
case "5":
var accountBalance = _currentCustomer.GetAccountBalance();
Console.WriteLine($"{accountBalance}");
Console.ReadLine();
break;
case "6":
isRunning = false;

View file

@ -8,15 +8,15 @@ namespace BankAppMarie
public string AccountNumber { get; set; }
public string Sender { get; set; }
public string KidNr { get; set; }
public int CustomerId { get; set; }
public int Id { get; set; }
public DateTime PayDate { get; set; }
public Bill(int billAmount, string billNumber, DateTime timeToPay, int customerId)
public Bill(int billAmount, string billNumber, DateTime timeToPay, int id)
{
Amount = billAmount;
KidNr = billNumber;
PayDate = timeToPay;
CustomerId = customerId;
Id = id;
}
}

View file

@ -57,17 +57,15 @@ namespace BankAppMarie
}
public void PrintBills()
{
var billNr = 1;
Console.Clear();
foreach (Bill bill in _bills)
{
Console.WriteLine($"{billNr}.) KidNr: {bill.KidNr} Amount: {bill.Amount}DueDate: {bill.PayDate}");
billNr++;
Console.WriteLine($"Id: {bill.Id}.) KidNr: {bill.KidNr} Amount: {bill.Amount}DueDate: {bill.PayDate.ToShortDateString()}");
}
Console.WriteLine("Please selcet bill id:");
var menuChoice = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please selcet bill id to pay:");
var billId = int.Parse(Console.ReadLine());
PayBill(billId);
}
public void PayBill(int billId)
@ -75,11 +73,12 @@ namespace BankAppMarie
var bill = GetBill(billId);
_currentAccount.Withdraw(bill.Amount);
_bills.Remove(bill);
_currentAccount.AddNewTransaction("Paid bill " + bill.KidNr);
}
public Bill GetBill(int billId)
{
Bill foundBill = _bills.First(bill => bill.CustomerId == billId);
Bill foundBill = _bills.First(bill => bill.Id == billId);
return foundBill;
}
}