Browse Source

coupon service initial commit

pull/2038/head
ihorkostrov 2 years ago
parent
commit
40d4a311f2
8 changed files with 184 additions and 0 deletions
  1. +32
    -0
      src/Coupon.API/Controllers/WeatherForecastController.cs
  2. +13
    -0
      src/Coupon.API/Coupon.API.csproj
  3. +25
    -0
      src/Coupon.API/Program.cs
  4. +31
    -0
      src/Coupon.API/Properties/launchSettings.json
  5. +12
    -0
      src/Coupon.API/WeatherForecast.cs
  6. +8
    -0
      src/Coupon.API/appsettings.Development.json
  7. +9
    -0
      src/Coupon.API/appsettings.json
  8. +54
    -0
      src/eShopOnContainers-ServicesAndWebApps.sln

+ 32
- 0
src/Coupon.API/Controllers/WeatherForecastController.cs View File

@ -0,0 +1,32 @@
using Microsoft.AspNetCore.Mvc;
namespace Coupon.API.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
- 0
src/Coupon.API/Coupon.API.csproj View File

@ -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
- 0
src/Coupon.API/Program.cs View File

@ -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
- 0
src/Coupon.API/Properties/launchSettings.json View File

@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:26091",
"sslPort": 44325
}
},
"profiles": {
"Coupon.API": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7014;http://localhost:5106",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

+ 12
- 0
src/Coupon.API/WeatherForecast.cs View File

@ -0,0 +1,12 @@
namespace Coupon.API;
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
- 0
src/Coupon.API/appsettings.Development.json View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

+ 9
- 0
src/Coupon.API/appsettings.json View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

+ 54
- 0
src/eShopOnContainers-ServicesAndWebApps.sln View File

@ -124,6 +124,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{373D8AA1
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBus.Tests", "BuildingBlocks\EventBus\EventBus.Tests\EventBus.Tests.csproj", "{95D735BE-2899-4495-BE3F-2600E93B4E3C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Coupon", "Coupon", "{EA8E5543-46DB-4646-B29B-847756FF0B37}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Coupon.API", "Coupon.API\Coupon.API.csproj", "{A50CFB1D-A31D-4399-9115-CF79A004E106}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@ -1530,6 +1534,54 @@ Global
{95D735BE-2899-4495-BE3F-2600E93B4E3C}.Release|x64.Build.0 = Release|Any CPU
{95D735BE-2899-4495-BE3F-2600E93B4E3C}.Release|x86.ActiveCfg = Release|Any CPU
{95D735BE-2899-4495-BE3F-2600E93B4E3C}.Release|x86.Build.0 = Release|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.AppStore|ARM.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.AppStore|iPhone.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.AppStore|x64.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.AppStore|x64.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.AppStore|x86.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.AppStore|x86.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Debug|ARM.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Debug|ARM.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Debug|iPhone.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Debug|x64.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Debug|x64.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Debug|x86.ActiveCfg = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Debug|x86.Build.0 = Debug|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Release|Any CPU.Build.0 = Release|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Release|ARM.ActiveCfg = Release|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Release|ARM.Build.0 = Release|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Release|iPhone.ActiveCfg = Release|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Release|iPhone.Build.0 = Release|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Release|x64.ActiveCfg = Release|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Release|x64.Build.0 = Release|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Release|x86.ActiveCfg = Release|Any CPU
{A50CFB1D-A31D-4399-9115-CF79A004E106}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1588,6 +1640,8 @@ Global
{B62E859F-825E-4C8B-93EC-5966EACFD026} = {798BFC44-2CCD-45FA-B37A-5173B03C2B30}
{373D8AA1-36BE-49EC-89F0-6CB736666285} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F}
{95D735BE-2899-4495-BE3F-2600E93B4E3C} = {373D8AA1-36BE-49EC-89F0-6CB736666285}
{EA8E5543-46DB-4646-B29B-847756FF0B37} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8}
{A50CFB1D-A31D-4399-9115-CF79A004E106} = {EA8E5543-46DB-4646-B29B-847756FF0B37}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9}


Loading…
Cancel
Save