develop #10
21
Serwer/Serwer.Api/Controllers/UserController.cs
Normal file
21
Serwer/Serwer.Api/Controllers/UserController.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Serwer.Infrastructure.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Api.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class UserController : ControllerBase
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
public UserController(IUserService userService)
|
||||
{
|
||||
_userService = userService;
|
||||
}
|
||||
}
|
||||
}
|
26
Serwer/Serwer.Api/Program.cs
Normal file
26
Serwer/Serwer.Api/Program.cs
Normal file
@ -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 Serwer.Api
|
||||
{
|
||||
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<Startup>();
|
||||
});
|
||||
}
|
||||
}
|
@ -1,30 +1,31 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:50287",
|
||||
"sslPort": 44305
|
||||
"applicationUrl": "http://localhost:50760",
|
||||
"sslPort": 44371
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "api/values",
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Serwer": {
|
||||
"Serwer.Api": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": "true",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "api/values",
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
18
Serwer/Serwer.Api/Serwer.Api.csproj
Normal file
18
Serwer/Serwer.Api/Serwer.Api.csproj
Normal file
@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0" NoWarn="NU1605" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.0" NoWarn="NU1605" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Serwer.Core\Serwer.Core.csproj" />
|
||||
<ProjectReference Include="..\Serwer.Infrastructure\Serwer.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@ -8,10 +8,14 @@ using Microsoft.AspNetCore.HttpsPolicy;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Serwer.Core.Repositories;
|
||||
using Serwer.Infrastructure.Repositories;
|
||||
using Serwer.Infrastructure.Services;
|
||||
|
||||
namespace Serwer
|
||||
namespace Serwer.Api
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
@ -25,24 +29,37 @@ namespace Serwer
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
|
||||
|
||||
services.AddControllers();
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Serwer.Api", Version = "v1" });
|
||||
});
|
||||
|
||||
services.AddScoped<IUserRepository, UserRepository>();
|
||||
services.AddScoped<IUserService, UserService>();
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Serwer.Api v1"));
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseMvc();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
9
Serwer/Serwer.Api/appsettings.Development.json
Normal file
9
Serwer/Serwer.Api/appsettings.Development.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
}
|
||||
}
|
10
Serwer/Serwer.Api/appsettings.json
Normal file
10
Serwer/Serwer.Api/appsettings.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
106
Serwer/Serwer.Core/Domain/User.cs
Normal file
106
Serwer/Serwer.Core/Domain/User.cs
Normal file
@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Core.Domain
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public Guid Id { get; protected set; }
|
||||
public string Email { get; protected set; }
|
||||
public string Name { get; protected set; }
|
||||
public string Surname { get; protected set; }
|
||||
public string Login { get; protected set; }
|
||||
public string Password { get; protected set; }
|
||||
public DateTime CreatedAt { get; protected set; }
|
||||
public DateTime UpdatedAt { get; protected set; }
|
||||
|
||||
protected User() { }
|
||||
public User(string email, string name, string surname, string login, string password)
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
SetEmail(email);
|
||||
SetName(name);
|
||||
SetSurname(surname);
|
||||
SetLogin(login);
|
||||
SetPassword(password);
|
||||
}
|
||||
|
||||
public void SetEmail(string email)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(email))
|
||||
{
|
||||
throw new Exception("Email cannot be empty");
|
||||
}
|
||||
if (Email == email)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Email = email;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public void SetName(string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
throw new Exception("Name cannot be empty");
|
||||
}
|
||||
if (Name == name)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Name = name;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public void SetSurname(string surname)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(surname))
|
||||
{
|
||||
throw new Exception("Surname cannot be empty");
|
||||
}
|
||||
if (Surname == surname)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Surname = surname;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public void SetLogin(string login)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(login))
|
||||
{
|
||||
throw new Exception("Login cannot be empty");
|
||||
}
|
||||
if (Login == login)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Login = login;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public void SetPassword(string password)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(password))
|
||||
{
|
||||
throw new Exception("Password cannot be empty");
|
||||
}
|
||||
if (Password == password)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Password = password;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
}
|
12
Serwer/Serwer.Core/Repositories/IRepository.cs
Normal file
12
Serwer/Serwer.Core/Repositories/IRepository.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Core.Repositories
|
||||
{
|
||||
public interface IRepository
|
||||
{
|
||||
}
|
||||
}
|
19
Serwer/Serwer.Core/Repositories/IUserRepository.cs
Normal file
19
Serwer/Serwer.Core/Repositories/IUserRepository.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using Serwer.Core.Domain;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Core.Repositories
|
||||
{
|
||||
public interface IUserRepository : IRepository
|
||||
{
|
||||
Task<User> GetAsync(Guid id);
|
||||
Task<User> GetAsync(string login);
|
||||
Task<IEnumerable<User>> GetAllAsync();
|
||||
Task AddAsync(User user);
|
||||
Task UpdateAsync(User user);
|
||||
Task RemoveAsync(Guid id);
|
||||
}
|
||||
}
|
7
Serwer/Serwer.Core/Serwer.Core.csproj
Normal file
7
Serwer/Serwer.Core/Serwer.Core.csproj
Normal file
@ -0,0 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
18
Serwer/Serwer.Infrastructure/DTO/UserDto.cs
Normal file
18
Serwer/Serwer.Infrastructure/DTO/UserDto.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Infrastructure.DTO
|
||||
{
|
||||
public class UserDto
|
||||
{
|
||||
public string Email { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Surname { get; set; }
|
||||
public string Login { get; set; }
|
||||
public DateTime CreatedAt { get; protected set; }
|
||||
public DateTime UpdatedAt { get; protected set; }
|
||||
}
|
||||
}
|
21
Serwer/Serwer.Infrastructure/Mappers/AutoMapperConfig.cs
Normal file
21
Serwer/Serwer.Infrastructure/Mappers/AutoMapperConfig.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using AutoMapper;
|
||||
using Serwer.Core.Domain;
|
||||
using Serwer.Infrastructure.DTO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Infrastructure.Mappers
|
||||
{
|
||||
public static class AutoMapperConfig
|
||||
{
|
||||
public static IMapper Initialize()
|
||||
=> new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<User, UserDto>();
|
||||
})
|
||||
.CreateMapper();
|
||||
}
|
||||
}
|
51
Serwer/Serwer.Infrastructure/Repositories/UserRepository.cs
Normal file
51
Serwer/Serwer.Infrastructure/Repositories/UserRepository.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using Serwer.Core.Domain;
|
||||
using Serwer.Core.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Infrastructure.Repositories
|
||||
{
|
||||
public class UserRepository : IUserRepository
|
||||
{
|
||||
private static ISet<User> _users = new HashSet<User>();
|
||||
|
||||
public async Task AddAsync(User user)
|
||||
{
|
||||
await Task.FromResult(_users.Add(user));
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<User>> GetAllAsync()
|
||||
{
|
||||
return await Task.FromResult(_users);
|
||||
}
|
||||
|
||||
public async Task<User> GetAsync(Guid id)
|
||||
{
|
||||
return await Task.FromResult(_users.SingleOrDefault(x => x.Id == id));
|
||||
}
|
||||
|
||||
public async Task<User> GetAsync(string login)
|
||||
{
|
||||
return await Task.FromResult(_users.SingleOrDefault(x => x.Login == login));
|
||||
}
|
||||
|
||||
public async Task RemoveAsync(Guid id)
|
||||
{
|
||||
var user = await GetAsync(id);
|
||||
_users.Remove(user);
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(User user)
|
||||
{
|
||||
var dbuser = await GetAsync(user.Id);
|
||||
dbuser.SetEmail(user.Email);
|
||||
dbuser.SetLogin(user.Login);
|
||||
dbuser.SetName(user.Name);
|
||||
dbuser.SetSurname(user.Surname);
|
||||
dbuser.SetPassword(user.Password);
|
||||
}
|
||||
}
|
||||
}
|
12
Serwer/Serwer.Infrastructure/Services/IUserService.cs
Normal file
12
Serwer/Serwer.Infrastructure/Services/IUserService.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Infrastructure.Services
|
||||
{
|
||||
public interface IUserService
|
||||
{
|
||||
}
|
||||
}
|
12
Serwer/Serwer.Infrastructure/Services/UserService.cs
Normal file
12
Serwer/Serwer.Infrastructure/Services/UserService.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serwer.Infrastructure.Services
|
||||
{
|
||||
public class UserService: IUserService
|
||||
{
|
||||
}
|
||||
}
|
15
Serwer/Serwer.Infrastructure/Serwer.Infrastructure.csproj
Normal file
15
Serwer/Serwer.Infrastructure/Serwer.Infrastructure.csproj
Normal file
@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Serwer.Core\Serwer.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,11 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.852
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30717.126
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serwer", "Serwer\Serwer.csproj", "{CCE1E4CC-EC14-46A3-BCC9-2CBD8F2284D6}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serwer.Tests", "Serwer.Tests\Serwer.Tests.csproj", "{4169F6FD-E08D-4329-BF87-A1411A9F1EF4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serwer.Tests", "Serwer.Tests\Serwer.Tests.csproj", "{4169F6FD-E08D-4329-BF87-A1411A9F1EF4}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serwer.Core", "Serwer.Core\Serwer.Core.csproj", "{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serwer.Infrastructure", "Serwer.Infrastructure\Serwer.Infrastructure.csproj", "{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82} = {115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serwer.Api", "Serwer.Api\Serwer.Api.csproj", "{335159FF-5AB8-48E5-A04C-778A46058204}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82} = {115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C} = {523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -13,14 +24,22 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CCE1E4CC-EC14-46A3-BCC9-2CBD8F2284D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CCE1E4CC-EC14-46A3-BCC9-2CBD8F2284D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CCE1E4CC-EC14-46A3-BCC9-2CBD8F2284D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CCE1E4CC-EC14-46A3-BCC9-2CBD8F2284D6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4169F6FD-E08D-4329-BF87-A1411A9F1EF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4169F6FD-E08D-4329-BF87-A1411A9F1EF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4169F6FD-E08D-4329-BF87-A1411A9F1EF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4169F6FD-E08D-4329-BF87-A1411A9F1EF4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{115E0BB1-FCC1-4E45-92B0-D3B6B4A3DA82}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{523E9EE6-B8D9-4E08-A9A0-50D7F872C79C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{335159FF-5AB8-48E5-A04C-778A46058204}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{335159FF-5AB8-48E5-A04C-778A46058204}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{335159FF-5AB8-48E5-A04C-778A46058204}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{335159FF-5AB8-48E5-A04C-778A46058204}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1,45 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Serwer.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ValuesController : ControllerBase
|
||||
{
|
||||
// GET api/values
|
||||
[HttpGet]
|
||||
public ActionResult<IEnumerable<string>> Get()
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
}
|
||||
|
||||
// GET api/values/5
|
||||
[HttpGet("{id}")]
|
||||
public ActionResult<string> Get(int id)
|
||||
{
|
||||
return "value";
|
||||
}
|
||||
|
||||
// POST api/values
|
||||
[HttpPost]
|
||||
public void Post([FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// PUT api/values/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Serwer
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateWebHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
.UseStartup<Startup>();
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Information",
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
Loading…
Reference in New Issue
Block a user