Skip to content

Commit

Permalink
#26 REST API - BankAccountController
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinajemuovic committed Jun 18, 2022
1 parent 7735e18 commit f1d1707
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Optivem.Kata.Banking.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Optivem.Kata.Banking.Infrastructure", "src\Optivem.Kata.Banking.Infrastructure\Optivem.Kata.Banking.Infrastructure.csproj", "{5ED71E33-2789-42BF-BA97-309E0BF23576}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Optivem.Kata.Banking.Infrastructure", "src\Optivem.Kata.Banking.Infrastructure\Optivem.Kata.Banking.Infrastructure.csproj", "{5ED71E33-2789-42BF-BA97-309E0BF23576}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Optivem.Kata.Banking.Web", "src\Optivem.Kata.Banking.Web\Optivem.Kata.Banking.Web.csproj", "{60BF7524-33C9-4FF0-9A90-9FD89590C091}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -49,6 +51,10 @@ Global
{5ED71E33-2789-42BF-BA97-309E0BF23576}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5ED71E33-2789-42BF-BA97-309E0BF23576}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5ED71E33-2789-42BF-BA97-309E0BF23576}.Release|Any CPU.Build.0 = Release|Any CPU
{60BF7524-33C9-4FF0-9A90-9FD89590C091}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60BF7524-33C9-4FF0-9A90-9FD89590C091}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60BF7524-33C9-4FF0-9A90-9FD89590C091}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60BF7524-33C9-4FF0-9A90-9FD89590C091}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -60,6 +66,7 @@ Global
{6F7B163D-5322-417B-BBF4-2F4D7B6CB90D} = {AE08FCE5-B7A9-4C14-B4CD-2556AEA39C61}
{BA3D1039-A55B-43AE-8FD1-A218D3099819} = {6F7B163D-5322-417B-BBF4-2F4D7B6CB90D}
{5ED71E33-2789-42BF-BA97-309E0BF23576} = {7A5CBAC9-F45B-408C-BC28-3ABBFB424E3E}
{60BF7524-33C9-4FF0-9A90-9FD89590C091} = {7A5CBAC9-F45B-408C-BC28-3ABBFB424E3E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7E8BB1C9-ACCB-46AB-88F8-F715384B5B0E}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Mvc;

namespace Optivem.Kata.Banking.Web.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

private readonly ILogger<WeatherForecastController> _logger;

public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}

[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
}
13 changes: 13 additions & 0 deletions src/Optivem.Kata.Banking.Web/Optivem.Kata.Banking.Web.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions src/Optivem.Kata.Banking.Web/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();
31 changes: 31 additions & 0 deletions src/Optivem.Kata.Banking.Web/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55085",
"sslPort": 44382
}
},
"profiles": {
"Optivem.Kata.Banking.Web": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7251;http://localhost:5251",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
13 changes: 13 additions & 0 deletions src/Optivem.Kata.Banking.Web/WeatherForecast.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Optivem.Kata.Banking.Web
{
public class WeatherForecast
{
public DateTime Date { get; set; }

public int TemperatureC { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

public string? Summary { get; set; }
}
}
8 changes: 8 additions & 0 deletions src/Optivem.Kata.Banking.Web/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
9 changes: 9 additions & 0 deletions src/Optivem.Kata.Banking.Web/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Optivem.Kata.Banking.Test.System
{
public class BankAccountControllerSystemTest
{


}
}

0 comments on commit f1d1707

Please sign in to comment.