Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions FlashcardsApp/FlashcardsApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35707.178 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlashcardsApp", "FlashcardsApp\FlashcardsApp.csproj", "{E87AE218-DC73-4974-9E12-5FE3DE56D12B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E87AE218-DC73-4974-9E12-5FE3DE56D12B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E87AE218-DC73-4974-9E12-5FE3DE56D12B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E87AE218-DC73-4974-9E12-5FE3DE56D12B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E87AE218-DC73-4974-9E12-5FE3DE56D12B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions FlashcardsApp/FlashcardsApp/DTOs/FlashcardDTO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace FlashcardsApp.DTOs;

internal class FlashcardDTO
{
public int DisplayNumber { get; set; }
public int FlashcardId { get; set; }
public string Front { get; set; }
public string Back { get; set; }
public DateTime CreatedDate { get; set; }
}
24 changes: 24 additions & 0 deletions FlashcardsApp/FlashcardsApp/FlashcardsApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.66" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.3" />
<PackageReference Include="Spectre.Console" Version="0.49.1" />
</ItemGroup>

<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
10 changes: 10 additions & 0 deletions FlashcardsApp/FlashcardsApp/Models/Flashcard.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace FlashcardsApp.Models;

internal class Flashcard
{
public int FlashcardId { get; set; }
public int StackId { get; set; }
public string Front { get; set; }
public string Back { get; set; }
public DateTime CreatedDate { get; set; }
}
9 changes: 9 additions & 0 deletions FlashcardsApp/FlashcardsApp/Models/Stack.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace FlashcardsApp.Models;

internal class Stack
{
public int StackId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public DateTime CreatedDate { get; set; }
}
9 changes: 9 additions & 0 deletions FlashcardsApp/FlashcardsApp/Models/StudySession.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace FlashcardsApp.Models;

internal class StudySession
{
public int SessionId { get; set; }
public int StackId { get; set; }
public string Score { get; set; }
public DateTime StudyDate { get; set; }
}
45 changes: 45 additions & 0 deletions FlashcardsApp/FlashcardsApp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Microsoft.Extensions.Configuration;
using FlashcardsApp.Services;
using FlashcardsApp.UI.Core;

namespace FlashcardsApp;

class Program
{
static IConfiguration? config; // a variable of type IConfiguration
static DatabaseService? databaseService;
static void Main(string[] args)
{
try
{
config = new ConfigurationBuilder() // Starting with an empty configuration but will return an IConfiguration object
.SetBasePath(Directory.GetCurrentDirectory()) // tells the builder where to look for configuration files (appsettings.json)
.AddJsonFile("appsettings.json") // what file it should be reading
.Build(); // creates the the IConfiguration object

string? connectionString = config.GetConnectionString("Default"); //GetConnectionString("Default") specifically looks for "ConnectionString" in appsettings.json
// and return the value associated with "Default"
if (connectionString == null)
{
throw new Exception("Connection string not found\n");

}

databaseService = new(connectionString);
databaseService.TestConnection();

Console.WriteLine("Successfully connected to server!\n");
}
catch (Exception ex)
{
Console.WriteLine($"Error loading database: {ex.Message}\n");
Console.WriteLine("Press Any Key to Exit...");
Console.ReadKey();
return;
}

MenuHandler menuHandler = new(databaseService);

menuHandler.MainMenu();
}
}
Loading