generated from admin/template
new
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokedexApi2", "PokedexApi2\PokedexApi2.csproj", "{726EA966-3EC2-4E25-9DC9-5C82383F659B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{726EA966-3EC2-4E25-9DC9-5C82383F659B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{726EA966-3EC2-4E25-9DC9-5C82383F659B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{726EA966-3EC2-4E25-9DC9-5C82383F659B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{726EA966-3EC2-4E25-9DC9-5C82383F659B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
namespace PokedexApi.Models;
|
||||
public record Pokemon(int Id, string Name, string Type, int Level);
|
||||
// TODO 1: объяви record Pokemon
|
||||
// Поля: Id (int), Name (string), Type (string), Level (int)
|
||||
|
||||
|
||||
public record PokemonInput( string Name, string Type, int Level);
|
||||
// TODO 2: объяви record PokemonInput
|
||||
// Поля: Name (string), Type (string), Level (int)
|
||||
|
||||
|
||||
public record LevelUpdate( int Level);
|
||||
// TODO 3: объяви record LevelUpdate
|
||||
// Поле: Level (int)
|
||||
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.11"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Endpoints\" />
|
||||
<Folder Include="Validation\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
@PokedexApi2_HostAddress = http://localhost:5189
|
||||
|
||||
GET {{PokedexApi2_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
@@ -0,0 +1,15 @@
|
||||
using PokedexApi.Models;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddOpenApi();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.MapOpenApi();
|
||||
}
|
||||
|
||||
app.Run();
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "http://localhost:5189",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "https://localhost:7085;http://localhost:5189",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using PokedexApi.Models;
|
||||
|
||||
namespace PokedexApi.Storage;
|
||||
|
||||
public class PokemonStorage
|
||||
{
|
||||
private List<Pokemon> _pokemons = new List<Pokemon>
|
||||
{
|
||||
new Pokemon(1, "Pikachu", "Electric", 12),
|
||||
new Pokemon(2, "Charmander", "Fire", 8),
|
||||
new Pokemon(3, "Squirtle", "Water", 10)
|
||||
};
|
||||
|
||||
// TODO 1: объяви приватный список _pokemons
|
||||
// с тремя стартовыми покемонами:
|
||||
// (1, "Pikachu", "Electric", 12)
|
||||
// (2, "Charmander", "Fire", 8)
|
||||
// (3, "Squirtle", "Water", 10)
|
||||
|
||||
// TODO 2: объяви приватное поле _lock типа object
|
||||
|
||||
// TODO 3: реализуй метод GetAll()
|
||||
// TODO 4: реализуй метод GetById(int id)
|
||||
// TODO 5: реализуй метод Filter(string? type, int? minLevel)
|
||||
// TODO 6: реализуй метод SearchByName(string query)
|
||||
// TODO 7: реализуй метод Add(PokemonInput input)
|
||||
// TODO 8: реализуй метод Update(int id, PokemonInput input)
|
||||
// TODO 9: реализуй метод UpdateLevel(int id, int level)
|
||||
// TODO 10: реализуй метод Delete(int id)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
Reference in New Issue
Block a user