diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..428a2fd --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (web)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceFolder}/ExpenseTracker.Api/bin/Debug/netcoreapp3.1/ExpenseTracker.dll", + "args": [], + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "stopAtEntry": false, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "sourceFileMap": { + "/Views": "${workspaceFolder}/Views" + } + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..d1c5216 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,36 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/ExpenseTracker.Api/ExpenseTracker.csproj" + ], + "problemMatcher": "$tsc" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/ExpenseTracker.Api/ExpenseTracker.csproj" + ], + "problemMatcher": "$tsc" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/ExpenseTracker.Api/ExpenseTracker.csproj" + ], + "problemMatcher": "$tsc" + } + ] +} \ No newline at end of file diff --git a/.gitignore b/ExpenseTracker.Api/.gitignore similarity index 100% rename from .gitignore rename to ExpenseTracker.Api/.gitignore diff --git a/ExpenseTracker.Api/Controllers/ExpenseController.cs b/ExpenseTracker.Api/Controllers/ExpenseController.cs new file mode 100644 index 0000000..873c3bc --- /dev/null +++ b/ExpenseTracker.Api/Controllers/ExpenseController.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using ExpenseTracker.Models; + +namespace ExpenseTracker.Controllers +{ + [ApiController] + [Route("[controller]")] + public class ExpenseController : ControllerBase + { + private readonly ILogger _logger; + + public ExpenseController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IEnumerable Get() + { + return new List(); + } + } +} diff --git a/ExpenseTracker.Api/ExpenseTracker.csproj b/ExpenseTracker.Api/ExpenseTracker.csproj new file mode 100644 index 0000000..400722f --- /dev/null +++ b/ExpenseTracker.Api/ExpenseTracker.csproj @@ -0,0 +1,8 @@ + + + + netcoreapp3.1 + + + + diff --git a/ExpenseTracker.Api/Models/Expense.cs b/ExpenseTracker.Api/Models/Expense.cs new file mode 100644 index 0000000..00fef1d --- /dev/null +++ b/ExpenseTracker.Api/Models/Expense.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; + +namespace ExpenseTracker.Models +{ + public enum ExpenseType + { + Food, + Drinks, + Other + } + public enum CurrencyType + { + Eur, + Gbp, + Usd, + Chf + } + public class Expense + { + public int ExpenseID { get; set; } + public decimal Amount { get; set; } + public string Recipient { get; set; } + public CurrencyType Currency { get; set; } + } +} \ No newline at end of file diff --git a/ExpenseTracker.Api/Program.cs b/ExpenseTracker.Api/Program.cs new file mode 100644 index 0000000..355883f --- /dev/null +++ b/ExpenseTracker.Api/Program.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; + +namespace ExpenseTracker +{ + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } +} diff --git a/ExpenseTracker.Api/Startup.cs b/ExpenseTracker.Api/Startup.cs new file mode 100644 index 0000000..343dd8b --- /dev/null +++ b/ExpenseTracker.Api/Startup.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.HttpsPolicy; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; + +namespace ExpenseTracker +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddControllers(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseHttpsRedirection(); + + app.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + } +} diff --git a/ExpenseTracker.Api/appsettings.Development.json b/ExpenseTracker.Api/appsettings.Development.json new file mode 100644 index 0000000..dba68eb --- /dev/null +++ b/ExpenseTracker.Api/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/ExpenseTracker.Api/appsettings.json b/ExpenseTracker.Api/appsettings.json new file mode 100644 index 0000000..81ff877 --- /dev/null +++ b/ExpenseTracker.Api/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..02e3c07 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Expense tracker \ No newline at end of file