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;
}
}

View file

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TowersOfHanoiTerje", "TowersOfHanoiTerje\TowersOfHanoiTerje.csproj", "{F15F32B0-1FC9-4D75-8EE4-942343B4DA3B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F15F32B0-1FC9-4D75-8EE4-942343B4DA3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F15F32B0-1FC9-4D75-8EE4-942343B4DA3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F15F32B0-1FC9-4D75-8EE4-942343B4DA3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F15F32B0-1FC9-4D75-8EE4-942343B4DA3B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,2 @@


View file

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View file

@ -5,8 +5,6 @@ mkShell {
name = "dotnet-env";
packages = [
(with dotnetCorePackages; combinePackages [
sdk_6_0
sdk_7_0
sdk_8_0
sdk_9_0
])