You have successfully logged out of the application.
+ }
+ }
+
diff --git a/src/Equinox.UI.Web/Areas/Identity/Pages/Account/Logout.cshtml.cs b/src/Equinox.UI.Web/Areas/Identity/Pages/Account/Logout.cshtml.cs
new file mode 100644
index 00000000..ffeec817
--- /dev/null
+++ b/src/Equinox.UI.Web/Areas/Identity/Pages/Account/Logout.cshtml.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+using Microsoft.Extensions.Logging;
+
+namespace Equinox.UI.Web.Areas.Identity.Pages.Account
+{
+ [AllowAnonymous]
+ public class LogoutModel : PageModel
+ {
+ private readonly SignInManager _signInManager;
+ private readonly ILogger _logger;
+
+ public LogoutModel(SignInManager signInManager, ILogger logger)
+ {
+ _signInManager = signInManager;
+ _logger = logger;
+ }
+
+ public void OnGet()
+ {
+ }
+
+ public async Task OnPost(string returnUrl = null)
+ {
+ await _signInManager.SignOutAsync();
+ _logger.LogInformation("User logged out.");
+ if (returnUrl != null)
+ {
+ return LocalRedirect(returnUrl);
+ }
+ else
+ {
+ return RedirectToPage();
+ }
+ }
+ }
+}
diff --git a/src/Equinox.UI.Web/Areas/Identity/Pages/Account/Register.cshtml.cs b/src/Equinox.UI.Web/Areas/Identity/Pages/Account/Register.cshtml.cs
index 52fcec43..097fd1bd 100644
--- a/src/Equinox.UI.Web/Areas/Identity/Pages/Account/Register.cshtml.cs
+++ b/src/Equinox.UI.Web/Areas/Identity/Pages/Account/Register.cshtml.cs
@@ -1,18 +1,12 @@
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
+using System.ComponentModel.DataAnnotations;
using System.Security.Claims;
using System.Text;
-using System.Text.Encodings.Web;
-using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
-using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;
-using Microsoft.Extensions.Logging;
namespace Equinox.UI.Web.Areas.Identity.Pages.Account
{
@@ -22,18 +16,15 @@ public class RegisterModel : PageModel
private readonly SignInManager _signInManager;
private readonly UserManager _userManager;
private readonly ILogger _logger;
- private readonly IEmailSender _emailSender;
public RegisterModel(
UserManager userManager,
SignInManager signInManager,
- ILogger logger,
- IEmailSender emailSender)
+ ILogger logger)
{
_userManager = userManager;
_signInManager = signInManager;
_logger = logger;
- _emailSender = emailSender;
}
[BindProperty]
@@ -91,9 +82,6 @@ public async Task OnPostAsync(string returnUrl = null)
values: new { area = "Identity", userId = user.Id, code },
protocol: Request.Scheme);
- await _emailSender.SendEmailAsync(Input.Email, "Confirm your email",
- $"Please confirm your account by clicking here.");
-
if (_userManager.Options.SignIn.RequireConfirmedAccount)
{
return RedirectToPage("RegisterConfirmation", new { email = Input.Email });
diff --git a/src/Equinox.UI.Web/Configurations/AutoMapperConfig.cs b/src/Equinox.UI.Web/Configurations/AutoMapperConfig.cs
index a62cc018..7ef2217c 100644
--- a/src/Equinox.UI.Web/Configurations/AutoMapperConfig.cs
+++ b/src/Equinox.UI.Web/Configurations/AutoMapperConfig.cs
@@ -1,16 +1,16 @@
-using System;
-using Equinox.Application.AutoMapper;
-using Microsoft.Extensions.DependencyInjection;
+using Equinox.Application.AutoMapper;
namespace Equinox.UI.Web.Configurations
{
public static class AutoMapperConfig
{
- public static void AddAutoMapperConfiguration(this IServiceCollection services)
+ public static WebApplicationBuilder AddAutoMapperConfiguration(this WebApplicationBuilder builder)
{
- if (services == null) throw new ArgumentNullException(nameof(services));
+ if (builder == null) throw new ArgumentNullException(nameof(builder));
- services.AddAutoMapper(typeof(DomainToViewModelMappingProfile), typeof(ViewModelToDomainMappingProfile));
+ builder.Services.AddAutoMapper(typeof(DomainToViewModelMappingProfile), typeof(ViewModelToDomainMappingProfile));
+
+ return builder;
}
}
}
\ No newline at end of file
diff --git a/src/Equinox.UI.Web/Configurations/DatabaseConfig.cs b/src/Equinox.UI.Web/Configurations/DatabaseConfig.cs
index 0e189cdc..2b8cf404 100644
--- a/src/Equinox.UI.Web/Configurations/DatabaseConfig.cs
+++ b/src/Equinox.UI.Web/Configurations/DatabaseConfig.cs
@@ -1,22 +1,21 @@
-using System;
-using Equinox.Infra.Data.Context;
+using Equinox.Infra.Data.Context;
using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
namespace Equinox.UI.Web.Configurations
{
public static class DatabaseConfig
{
- public static void AddDatabaseConfiguration(this IServiceCollection services, IConfiguration configuration)
+ public static WebApplicationBuilder AddDatabaseConfiguration(this WebApplicationBuilder builder)
{
- if (services == null) throw new ArgumentNullException(nameof(services));
+ if (builder == null) throw new ArgumentNullException(nameof(builder));
- services.AddDbContext(options =>
- options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));
+ builder.Services.AddDbContext(options =>
+ options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
- services.AddDbContext(options =>
- options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));
+ builder.Services.AddDbContext(options =>
+ options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
+
+ return builder;
}
}
}
\ No newline at end of file
diff --git a/src/Equinox.UI.Web/Configurations/DependencyInjectionConfig.cs b/src/Equinox.UI.Web/Configurations/DependencyInjectionConfig.cs
index bdd4dfe0..e518d50a 100644
--- a/src/Equinox.UI.Web/Configurations/DependencyInjectionConfig.cs
+++ b/src/Equinox.UI.Web/Configurations/DependencyInjectionConfig.cs
@@ -1,16 +1,14 @@
-using System;
-using Equinox.Infra.CrossCutting.IoC;
-using Microsoft.Extensions.DependencyInjection;
+using Equinox.Infra.CrossCutting.IoC;
namespace Equinox.UI.Web.Configurations
{
public static class DependencyInjectionConfig
{
- public static void AddDependencyInjectionConfiguration(this IServiceCollection services)
+ public static void AddDependencyInjectionConfiguration(this WebApplicationBuilder builder)
{
- if (services == null) throw new ArgumentNullException(nameof(services));
+ if (builder == null) throw new ArgumentNullException(nameof(builder));
- NativeInjectorBootStrapper.RegisterServices(services);
+ NativeInjectorBootStrapper.RegisterServices(builder);
}
}
}
\ No newline at end of file
diff --git a/src/Equinox.UI.Web/Configurations/IdentityConfig.cs b/src/Equinox.UI.Web/Configurations/IdentityConfig.cs
index cc58b62f..9780c237 100644
--- a/src/Equinox.UI.Web/Configurations/IdentityConfig.cs
+++ b/src/Equinox.UI.Web/Configurations/IdentityConfig.cs
@@ -1,27 +1,8 @@
-using System;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Equinox.UI.Web.Configurations
+namespace Equinox.UI.Web.Configurations
{
public static class IdentityConfig
{
- public static void AddSocialAuthenticationConfiguration(this IServiceCollection services, IConfiguration configuration)
- {
- if (services == null) throw new ArgumentNullException(nameof(services));
-
- services.AddAuthentication()
- .AddFacebook(o =>
- {
- o.AppId = configuration["Authentication:Facebook:AppId"];
- o.AppSecret = configuration["Authentication:Facebook:AppSecret"];
- })
- .AddGoogle(googleOptions =>
- {
- googleOptions.ClientId = configuration["Authentication:Google:ClientId"];
- googleOptions.ClientSecret = configuration["Authentication:Google:ClientSecret"];
- });
- }
+
}
}
\ No newline at end of file
diff --git a/src/Equinox.UI.Web/Configurations/MediatRConfig.cs b/src/Equinox.UI.Web/Configurations/MediatRConfig.cs
new file mode 100644
index 00000000..2b3dee57
--- /dev/null
+++ b/src/Equinox.UI.Web/Configurations/MediatRConfig.cs
@@ -0,0 +1,16 @@
+using System.Reflection;
+
+namespace Equinox.UI.Web.Configurations
+{
+ public static class MediatRConfig
+ {
+ public static WebApplicationBuilder AddMediatRConfiguration(this WebApplicationBuilder builder)
+ {
+ if (builder == null) throw new ArgumentNullException(nameof(builder));
+
+ builder.Services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly()));
+
+ return builder;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Equinox.UI.Web/Configurations/MvcConfig.cs b/src/Equinox.UI.Web/Configurations/MvcConfig.cs
new file mode 100644
index 00000000..0e7b903c
--- /dev/null
+++ b/src/Equinox.UI.Web/Configurations/MvcConfig.cs
@@ -0,0 +1,27 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace Equinox.UI.Web.Configurations
+{
+ public static class MvcConfig
+ {
+ public static WebApplicationBuilder AddMvcConfiguration(this WebApplicationBuilder builder)
+ {
+ if (builder == null) throw new ArgumentNullException(nameof(builder));
+
+ builder.Configuration
+ .SetBasePath(builder.Environment.ContentRootPath)
+ .AddJsonFile("appsettings.json", true, true)
+ .AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", true, true)
+ .AddEnvironmentVariables();
+
+ builder.Services.AddControllersWithViews(options =>
+ {
+ options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
+ });
+
+ builder.Services.AddRazorPages();
+
+ return builder;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Equinox.UI.Web/Controllers/BaseController.cs b/src/Equinox.UI.Web/Controllers/BaseController.cs
index fa9f0d22..e0fa8be6 100644
--- a/src/Equinox.UI.Web/Controllers/BaseController.cs
+++ b/src/Equinox.UI.Web/Controllers/BaseController.cs
@@ -1,6 +1,4 @@
-using System.Collections.Generic;
-using System.Linq;
-using FluentValidation.Results;
+using FluentValidation.Results;
using Microsoft.AspNetCore.Mvc;
namespace Equinox.UI.Web.Controllers
diff --git a/src/Equinox.UI.Web/Controllers/CustomerController.cs b/src/Equinox.UI.Web/Controllers/CustomerController.cs
index a43ef1c3..3cfa5cdb 100644
--- a/src/Equinox.UI.Web/Controllers/CustomerController.cs
+++ b/src/Equinox.UI.Web/Controllers/CustomerController.cs
@@ -1,10 +1,8 @@
-using System;
-using System.Threading.Tasks;
using Equinox.Application.Interfaces;
using Equinox.Application.ViewModels;
+using Equinox.Infra.CrossCutting.Identity.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using NetDevPack.Identity.Authorization;
namespace Equinox.UI.Web.Controllers
{
diff --git a/src/Equinox.UI.Web/Data/Migrations/00000000000000_CreateIdentitySchema.cs b/src/Equinox.UI.Web/Data/Migrations/00000000000000_CreateIdentitySchema.cs
index 27e670ea..eaa9ec6c 100644
--- a/src/Equinox.UI.Web/Data/Migrations/00000000000000_CreateIdentitySchema.cs
+++ b/src/Equinox.UI.Web/Data/Migrations/00000000000000_CreateIdentitySchema.cs
@@ -1,6 +1,5 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
-using System;
namespace Equinox.UI.Web.Data.Migrations
{
diff --git a/src/Equinox.UI.Web/Equinox.UI.Web.csproj b/src/Equinox.UI.Web/Equinox.UI.Web.csproj
index f944e223..cb732910 100644
--- a/src/Equinox.UI.Web/Equinox.UI.Web.csproj
+++ b/src/Equinox.UI.Web/Equinox.UI.Web.csproj
@@ -1,31 +1,30 @@
- net6.0
+ net8.0
+ disableaspnet-Equinox.UI.Web-61A38C1A-B3EE-4175-AD27-CD2A22786741enableLinux..\..
-
-
-
-
-
-
+
+
+
+
+
+
+
+ allruntime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
+
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/Equinox.UI.Web/Program.cs b/src/Equinox.UI.Web/Program.cs
index 1657d32c..07667e82 100644
--- a/src/Equinox.UI.Web/Program.cs
+++ b/src/Equinox.UI.Web/Program.cs
@@ -1,76 +1,38 @@
-using Equinox.Infra.CrossCutting.Identity;
using Equinox.UI.Web.Configurations;
-using MediatR;
-using Microsoft.AspNetCore.Mvc;
-using NetDevPack.Identity;
-using NetDevPack.Identity.User;
+using Equinox.Infra.CrossCutting.Identity.Configuration;
var builder = WebApplication.CreateBuilder(args);
-builder.Configuration
- .SetBasePath(builder.Environment.ContentRootPath)
- .AddJsonFile("appsettings.json", true, true)
- .AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", true, true)
- .AddEnvironmentVariables();
-
-// ConfigureServices
-
-builder.Services.AddControllersWithViews(options =>
-{
- options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
-});
-builder.Services.AddRazorPages();
-
-// Setting DBContexts
-builder.Services.AddDatabaseConfiguration(builder.Configuration);
-
-// ASP.NET Identity Settings
-builder.Services.AddWebAppIdentityConfiguration(builder.Configuration);
-
-// Authentication & Authorization
-builder.Services.AddSocialAuthenticationConfiguration(builder.Configuration);
-
-// Interactive AspNetUser (logged in)
-// NetDevPack.Identity dependency
-builder.Services.AddAspNetUserConfiguration();
-
-// AutoMapper Settings
-builder.Services.AddAutoMapperConfiguration();
-
-// Adding MediatR for Domain Events and Notifications
-builder.Services.AddMediatR(AppDomain.CurrentDomain.GetAssemblies());
-
-// .NET Native DI Abstraction
-builder.Services.AddDependencyInjectionConfiguration();
+// Adding Services
+builder.AddMvcConfiguration() // Entire Equinox MVC Config
+ .AddDatabaseConfiguration() // Setting DBContexts
+ .AddWebIdentityConfiguration() // ASP.NET Identity Config
+ .AddAutoMapperConfiguration() // AutoMapper Config
+ .AddMediatRConfiguration() // Adding MediatR for Domain Events and Notifications
+ .AddDependencyInjectionConfiguration(); // DotNet Native DI Abstraction
var app = builder.Build();
-// Configure
-
+// Configure Services
if (app.Environment.IsDevelopment())
{
- app.UseDeveloperExceptionPage();
- app.UseMigrationsEndPoint();
+ app.UseDeveloperExceptionPage()
+ .UseMigrationsEndPoint();
}
else
{
- app.UseExceptionHandler("/error/500");
- app.UseStatusCodePagesWithRedirects("/error/{0}");
- app.UseHsts();
+ app.UseExceptionHandler("/error/500")
+ .UseStatusCodePagesWithRedirects("/error/{0}")
+ .UseHsts();
}
-app.UseHttpsRedirection();
-app.UseStaticFiles();
-
-app.UseRouting();
-
-// NetDevPack.Identity dependency
-app.UseAuthConfiguration();
-
-app.MapControllerRoute(
- name: "default",
- pattern: "{controller=Home}/{action=Index}/{id?}");
+app.UseHttpsRedirection()
+ .UseStaticFiles()
+ .UseRouting()
+ .UseAuthentication()
+ .UseAuthorization();
+app.MapControllerRoute(name: "default",pattern: "{controller=Home}/{action=Index}/{id?}");
app.MapRazorPages();
app.Run();
diff --git a/src/Equinox.UI.Web/Views/Customer/Index.cshtml b/src/Equinox.UI.Web/Views/Customer/Index.cshtml
index 9309318f..235dc8e0 100644
--- a/src/Equinox.UI.Web/Views/Customer/Index.cshtml
+++ b/src/Equinox.UI.Web/Views/Customer/Index.cshtml
@@ -123,7 +123,7 @@
$(".viewbutton").on("click", function() {
var customerId = $(this).data('id');
$.ajax({
- url: "https://localhost:44314/customer-management/customer-history/" + customerId,
+ url: "https://localhost:5001/customer-management/customer-history/" + customerId,
//url: "http://equinoxproject.azurewebsites.net/customer-management/customer-history/" + customerId,
cache: false
}).done(function(data) {
diff --git a/src/Equinox.UI.Web/Views/Home/Index.cshtml b/src/Equinox.UI.Web/Views/Home/Index.cshtml
index c4e5a6c1..ee966bf9 100644
--- a/src/Equinox.UI.Web/Views/Home/Index.cshtml
+++ b/src/Equinox.UI.Web/Views/Home/Index.cshtml
@@ -20,11 +20,11 @@
Technologies
-
.NET 6.0
-
ASP.NET MVC 6.0
-
ASP.NET WebAPI 6.0
-
ASP.NET Identity 6.0
-
EF Core 6.0
+
.NET 8.0
+
ASP.NET MVC 8.0
+
ASP.NET WebAPI 8.0
+
ASP.NET Identity 8.0
+
EF Core 8.0
AutoMapper
FluentValidator
MediatR
diff --git a/src/Equinox.UI.Web/wwwroot/images/banner1.svg b/src/Equinox.UI.Web/wwwroot/images/banner1.svg
index ebd3bfe5..e17e7208 100644
--- a/src/Equinox.UI.Web/wwwroot/images/banner1.svg
+++ b/src/Equinox.UI.Web/wwwroot/images/banner1.svg
@@ -13,7 +13,7 @@
Run your application anywhere
- ASP.NET 6.0
+ ASP.NET 8.0