Skip to content

Commit 5f46f1a

Browse files
committed
update api
1 parent 0ed4cb8 commit 5f46f1a

File tree

14 files changed

+71
-171
lines changed

14 files changed

+71
-171
lines changed

LMYFrameworkCore/LMYFrameworkCore.sln

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DB", "DB", "{142E206A-8FC0-
2424
DB\script.sql = DB\script.sql
2525
EndProjectSection
2626
EndProject
27-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Services.Security.API", "Services.Security.API\Services.Security.API.csproj", "{EA7485B0-7996-40EA-AC86-F8908F19A717}"
27+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Services.Security.API", "Services\Security\Services.Security.API\Services.Security.API.csproj", "{4834F6D4-95D3-482C-ADCC-6485DE28B73D}"
2828
EndProject
2929
Global
3030
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -48,10 +48,10 @@ Global
4848
{AE5233B6-6861-4F61-862A-2523EFCC45D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
4949
{AE5233B6-6861-4F61-862A-2523EFCC45D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
5050
{AE5233B6-6861-4F61-862A-2523EFCC45D3}.Release|Any CPU.Build.0 = Release|Any CPU
51-
{EA7485B0-7996-40EA-AC86-F8908F19A717}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
52-
{EA7485B0-7996-40EA-AC86-F8908F19A717}.Debug|Any CPU.Build.0 = Debug|Any CPU
53-
{EA7485B0-7996-40EA-AC86-F8908F19A717}.Release|Any CPU.ActiveCfg = Release|Any CPU
54-
{EA7485B0-7996-40EA-AC86-F8908F19A717}.Release|Any CPU.Build.0 = Release|Any CPU
51+
{4834F6D4-95D3-482C-ADCC-6485DE28B73D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
52+
{4834F6D4-95D3-482C-ADCC-6485DE28B73D}.Debug|Any CPU.Build.0 = Debug|Any CPU
53+
{4834F6D4-95D3-482C-ADCC-6485DE28B73D}.Release|Any CPU.ActiveCfg = Release|Any CPU
54+
{4834F6D4-95D3-482C-ADCC-6485DE28B73D}.Release|Any CPU.Build.0 = Release|Any CPU
5555
EndGlobalSection
5656
GlobalSection(SolutionProperties) = preSolution
5757
HideSolutionNode = FALSE
@@ -62,7 +62,7 @@ Global
6262
{0E473853-B760-4066-BD3E-E26F35AD8458} = {3224DEB9-DA8C-44B4-B6E8-848103410845}
6363
{12492165-13C0-4CFD-9C54-23535AF39AED} = {3224DEB9-DA8C-44B4-B6E8-848103410845}
6464
{AE5233B6-6861-4F61-862A-2523EFCC45D3} = {ECDF6A7F-D566-4023-BDF4-F15B719A671D}
65-
{EA7485B0-7996-40EA-AC86-F8908F19A717} = {3224DEB9-DA8C-44B4-B6E8-848103410845}
65+
{4834F6D4-95D3-482C-ADCC-6485DE28B73D} = {3224DEB9-DA8C-44B4-B6E8-848103410845}
6666
EndGlobalSection
6767
GlobalSection(ExtensibilityGlobals) = postSolution
6868
SolutionGuid = {3122A2AE-647C-4652-B13E-6C40538497FD}

LMYFrameworkCore/Services.Security.API/Program.cs

Lines changed: 0 additions & 43 deletions
This file was deleted.

LMYFrameworkCore/Services.Security.API/Properties/launchSettings.json

Lines changed: 0 additions & 31 deletions
This file was deleted.

LMYFrameworkCore/Services.Security.API/Services.Security.API.csproj

Lines changed: 0 additions & 20 deletions
This file was deleted.

LMYFrameworkCore/Services.Security.API/appsettings.Development.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

LMYFrameworkCore/Services.Security.API/appsettings.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

LMYFrameworkCore/Services/Security/Services.Security.API/Controllers/ValuesController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class ValuesController : BaseController
2020
public ValuesController(IUserService userService, IConfiguration configuration) :
2121
base(configuration)
2222
{
23+
_userService = userService;
2324
}
2425

2526
// GET api/values
Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,43 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Threading.Tasks;
6-
using Microsoft.AspNetCore;
7-
using Microsoft.AspNetCore.Hosting;
8-
using Microsoft.Extensions.Configuration;
9-
using Microsoft.Extensions.Logging;
10-
11-
namespace Services.Security.API
1+
using Framework.Common.Interfaces;
2+
using Microsoft.EntityFrameworkCore;
3+
using Services.Security.Core.Interfaces;
4+
using Services.Security.Core.Services;
5+
using Services.Security.Infrastructure;
6+
using Services.Security.Infrastructure.Entities;
7+
8+
var builder = WebApplication.CreateBuilder(args);
9+
10+
// Add services to the container.
11+
12+
builder.Services.AddControllers();
13+
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
14+
builder.Services.AddEndpointsApiExplorer();
15+
builder.Services.AddSwaggerGen();
16+
17+
builder.Services.AddDbContext<EFDBContext>(
18+
options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))
19+
);
20+
21+
builder.Services.AddTransient<IGenericRepository<Users>, GenericRepository<Users, EFDBContext>>();
22+
builder.Services.AddTransient<IGenericRepository<UserRoles>, GenericRepository<UserRoles, EFDBContext>>();
23+
builder.Services.AddTransient<IGenericRepository<Roles>, GenericRepository<Roles, EFDBContext>>();
24+
builder.Services.AddTransient<IGenericUnitOfwork<EFDBContext>, GenericUnitOfWork<EFDBContext>>();
25+
26+
builder.Services.AddTransient<IUserService, UserService>();
27+
28+
var app = builder.Build();
29+
30+
// Configure the HTTP request pipeline.
31+
if (app.Environment.IsDevelopment())
1232
{
13-
public class Program
14-
{
15-
public static void Main(string[] args)
16-
{
17-
CreateWebHostBuilder(args).Build().Run();
18-
}
19-
20-
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21-
WebHost.CreateDefaultBuilder(args)
22-
.UseStartup<Startup>();
23-
}
33+
app.UseSwagger();
34+
app.UseSwaggerUI();
2435
}
36+
37+
app.UseHttpsRedirection();
38+
39+
app.UseAuthorization();
40+
41+
app.MapControllers();
42+
43+
app.Run();
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
{
2-
"$schema": "http://json.schemastore.org/launchsettings.json",
2+
"$schema": "https://json.schemastore.org/launchsettings.json",
33
"iisSettings": {
4-
"windowsAuthentication": false,
5-
"anonymousAuthentication": true,
4+
"windowsAuthentication": false,
5+
"anonymousAuthentication": true,
66
"iisExpress": {
7-
"applicationUrl": "http://localhost:51403",
8-
"sslPort": 44314
7+
"applicationUrl": "http://localhost:55110",
8+
"sslPort": 44375
99
}
1010
},
1111
"profiles": {
12-
"IIS Express": {
13-
"commandName": "IISExpress",
12+
"Services.Security.API": {
13+
"commandName": "Project",
14+
"dotnetRunMessages": true,
1415
"launchBrowser": true,
15-
"launchUrl": "api/values",
16+
"launchUrl": "swagger",
17+
"applicationUrl": "https://localhost:7037;http://localhost:5164",
1618
"environmentVariables": {
1719
"ASPNETCORE_ENVIRONMENT": "Development"
1820
}
1921
},
20-
"Services.Security.API": {
21-
"commandName": "Project",
22+
"IIS Express": {
23+
"commandName": "IISExpress",
2224
"launchBrowser": true,
23-
"launchUrl": "api/values",
24-
"applicationUrl": "https://localhost:5001;http://localhost:5000",
25+
"launchUrl": "swagger",
2526
"environmentVariables": {
2627
"ASPNETCORE_ENVIRONMENT": "Development"
2728
}
2829
}
2930
}
30-
}
31+
}

0 commit comments

Comments
 (0)