From 3e1555d052b0685900b46f3bad3edaa088274355 Mon Sep 17 00:00:00 2001 From: Wvader <34067397+wvader@users.noreply.github.com> Date: Mon, 26 Sep 2022 02:05:23 +0100 Subject: [PATCH] Before separating auth --- .../BlueWest.Authorization.csproj | 13 ++ .../Controllers/WeatherForecastController.cs | 32 +++ BlueWest.Authorization/Program.cs | 25 +++ .../Properties/launchSettings.json | 31 +++ BlueWest.Authorization/WeatherForecast.cs | 12 ++ .../appsettings.Development.json | 8 + BlueWest.Authorization/appsettings.json | 9 + .../BlueWest.Razor.Library.csproj | 18 ++ BlueWest.Razor.Library/Component1.razor | 3 + BlueWest.Razor.Library/Component1.razor.css | 6 + BlueWest.Razor.Library/ExampleJsInterop.cs | 36 ++++ BlueWest.Razor.Library/_Imports.razor | 1 + BlueWest.Razor.Library/wwwroot/background.png | Bin 0 -> 378 bytes .../wwwroot/exampleJsInterop.js | 6 + BlueWest.Views/BlueWest.Views.csproj | 35 ++++ BlueWest.Views/Controllers/AuthController.cs | 10 + .../Controllers/CapitalController.cs | 24 --- .../Controllers/Data/BanksController.cs | 12 ++ .../Controllers/Data/CompaniesController.cs | 12 ++ .../Controllers/Data/CountriesController.cs | 12 ++ .../Controllers/Data/CurrenciesController.cs | 8 + .../Controllers/Data/DataController.cs | 17 ++ BlueWest.Views/Controllers/HomeController.cs | 23 +-- BlueWest.Views/Controllers/JobsController.cs | 33 +++ .../System/ApplicationUsersController.cs | 8 + .../Controllers/System/DataUsersController.cs | 8 + .../Controllers/System/LogsController.cs | 8 + .../Controllers/System/RolesController.cs | 14 ++ .../{ => System}/SystemController.cs | 12 +- BlueWest.Views/Controllers/UsersController.cs | 8 + BlueWest.Views/GlobalUsings.cs | 3 + BlueWest.Views/Languages/CultureSwitch.cs | 9 + .../Languages/CultureSwitchViewComponent.cs | 27 +++ BlueWest.Views/Models/SystemPageModel.cs | 8 - BlueWest.Views/Models/UserPageModel.cs | 10 - BlueWest.Views/Program.cs | 28 +++ BlueWest.Views/Utils/ControllerExtensions.cs | 27 +++ BlueWest.Views/Utils/LayoutCache.cs | 180 +++++++++++++++++ BlueWest.Views/Utils/LinkViewInformation.cs | 13 ++ BlueWest.Views/Utils/Menus.cs | 7 + BlueWest.Views/Utils/RouteRecord.cs | 14 ++ BlueWest.Views/Utils/Routes.cs | 190 ++++++++++++++++++ BlueWest.Views/Utils/ViewType.cs | 16 ++ BlueWest.Views/Views/Banks/Index.cshtml | 18 ++ BlueWest.Views/Views/Capital/Index.cshtml | 8 - .../Views/Data/Companies/Index.cshtml | 11 + .../Views/Data/Countries/Index.cshtml | 11 + BlueWest.Views/Views/Data/Index.cshtml | 11 + BlueWest.Views/Views/Home/Index.cshtml | 28 ++- BlueWest.Views/Views/Jobs/Index.cshtml | 10 + BlueWest.Views/Views/Shared/UsersMenu.cshtml | 59 ++++++ .../Views/Shared/_FooterMenu.cshtml | 31 +++ .../Views/Shared/_HeaderMenu.cshtml | 24 ++- BlueWest.Views/Views/Shared/_Layout.cshtml | 63 ++---- .../Views/Shared/_Layout.cshtml.css | 25 +-- BlueWest.Views/Views/System/Index.cshtml | 10 +- BlueWest.Views/Views/System/Roles.cshtml | 8 - .../System/Roles/Index.cshtml} | 0 BlueWest.Views/Views/System/Users.cshtml | 4 +- BlueWest.Views/Views/_ViewImports.cshtml | 9 +- BlueWest.Views/Web.config | 14 ++ BlueWest.Views/wwwroot/css/site.css | 18 -- BlueWest.Views/wwwroot/js/site.js | 4 - .../jquery.validate.unobtrusive.js | 0 .../jquery.validate.unobtrusive.min.js | 0 .../wwwroot/lib/jquery-validation/LICENSE.md | 0 .../dist/additional-methods.js | 0 .../dist/additional-methods.min.js | 0 .../jquery-validation/dist/jquery.validate.js | 0 .../dist/jquery.validate.min.js | 0 BlueWest.Views/wwwroot/lib/jquery/LICENSE.txt | 0 .../wwwroot/lib/jquery/dist/jquery.js | 0 .../wwwroot/lib/jquery/dist/jquery.min.js | 0 .../wwwroot/lib/jquery/dist/jquery.min.map | 0 BlueWest.Views/wwwroot/static/main.css | 27 ++- BlueWest.sln | 6 + 76 files changed, 1190 insertions(+), 185 deletions(-) create mode 100644 BlueWest.Authorization/BlueWest.Authorization.csproj create mode 100644 BlueWest.Authorization/Controllers/WeatherForecastController.cs create mode 100644 BlueWest.Authorization/Program.cs create mode 100644 BlueWest.Authorization/Properties/launchSettings.json create mode 100644 BlueWest.Authorization/WeatherForecast.cs create mode 100644 BlueWest.Authorization/appsettings.Development.json create mode 100644 BlueWest.Authorization/appsettings.json create mode 100644 BlueWest.Razor.Library/BlueWest.Razor.Library.csproj create mode 100644 BlueWest.Razor.Library/Component1.razor create mode 100644 BlueWest.Razor.Library/Component1.razor.css create mode 100644 BlueWest.Razor.Library/ExampleJsInterop.cs create mode 100644 BlueWest.Razor.Library/_Imports.razor create mode 100644 BlueWest.Razor.Library/wwwroot/background.png create mode 100644 BlueWest.Razor.Library/wwwroot/exampleJsInterop.js create mode 100644 BlueWest.Views/Controllers/AuthController.cs delete mode 100644 BlueWest.Views/Controllers/CapitalController.cs create mode 100644 BlueWest.Views/Controllers/Data/BanksController.cs create mode 100644 BlueWest.Views/Controllers/Data/CompaniesController.cs create mode 100644 BlueWest.Views/Controllers/Data/CountriesController.cs create mode 100644 BlueWest.Views/Controllers/Data/CurrenciesController.cs create mode 100644 BlueWest.Views/Controllers/Data/DataController.cs create mode 100644 BlueWest.Views/Controllers/JobsController.cs create mode 100644 BlueWest.Views/Controllers/System/ApplicationUsersController.cs create mode 100644 BlueWest.Views/Controllers/System/DataUsersController.cs create mode 100644 BlueWest.Views/Controllers/System/LogsController.cs create mode 100644 BlueWest.Views/Controllers/System/RolesController.cs rename BlueWest.Views/Controllers/{ => System}/SystemController.cs (78%) create mode 100644 BlueWest.Views/Controllers/UsersController.cs create mode 100644 BlueWest.Views/GlobalUsings.cs create mode 100644 BlueWest.Views/Languages/CultureSwitch.cs create mode 100644 BlueWest.Views/Languages/CultureSwitchViewComponent.cs delete mode 100644 BlueWest.Views/Models/SystemPageModel.cs delete mode 100644 BlueWest.Views/Models/UserPageModel.cs create mode 100644 BlueWest.Views/Utils/ControllerExtensions.cs create mode 100644 BlueWest.Views/Utils/LayoutCache.cs create mode 100644 BlueWest.Views/Utils/LinkViewInformation.cs create mode 100644 BlueWest.Views/Utils/Menus.cs create mode 100644 BlueWest.Views/Utils/RouteRecord.cs create mode 100644 BlueWest.Views/Utils/Routes.cs create mode 100644 BlueWest.Views/Utils/ViewType.cs create mode 100644 BlueWest.Views/Views/Banks/Index.cshtml delete mode 100644 BlueWest.Views/Views/Capital/Index.cshtml create mode 100644 BlueWest.Views/Views/Data/Companies/Index.cshtml create mode 100644 BlueWest.Views/Views/Data/Countries/Index.cshtml create mode 100644 BlueWest.Views/Views/Data/Index.cshtml create mode 100644 BlueWest.Views/Views/Jobs/Index.cshtml create mode 100644 BlueWest.Views/Views/Shared/UsersMenu.cshtml create mode 100644 BlueWest.Views/Views/Shared/_FooterMenu.cshtml delete mode 100644 BlueWest.Views/Views/System/Roles.cshtml rename BlueWest.Views/{wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt => Views/System/Roles/Index.cshtml} (100%) create mode 100644 BlueWest.Views/Web.config delete mode 100644 BlueWest.Views/wwwroot/css/site.css delete mode 100644 BlueWest.Views/wwwroot/js/site.js delete mode 100644 BlueWest.Views/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js delete mode 100644 BlueWest.Views/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js delete mode 100644 BlueWest.Views/wwwroot/lib/jquery-validation/LICENSE.md delete mode 100644 BlueWest.Views/wwwroot/lib/jquery-validation/dist/additional-methods.js delete mode 100644 BlueWest.Views/wwwroot/lib/jquery-validation/dist/additional-methods.min.js delete mode 100644 BlueWest.Views/wwwroot/lib/jquery-validation/dist/jquery.validate.js delete mode 100644 BlueWest.Views/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js delete mode 100644 BlueWest.Views/wwwroot/lib/jquery/LICENSE.txt delete mode 100644 BlueWest.Views/wwwroot/lib/jquery/dist/jquery.js delete mode 100644 BlueWest.Views/wwwroot/lib/jquery/dist/jquery.min.js delete mode 100644 BlueWest.Views/wwwroot/lib/jquery/dist/jquery.min.map diff --git a/BlueWest.Authorization/BlueWest.Authorization.csproj b/BlueWest.Authorization/BlueWest.Authorization.csproj new file mode 100644 index 0000000..6108b7b --- /dev/null +++ b/BlueWest.Authorization/BlueWest.Authorization.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/BlueWest.Authorization/Controllers/WeatherForecastController.cs b/BlueWest.Authorization/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..18749ed --- /dev/null +++ b/BlueWest.Authorization/Controllers/WeatherForecastController.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Authorization.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 _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable 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(); + } +} diff --git a/BlueWest.Authorization/Program.cs b/BlueWest.Authorization/Program.cs new file mode 100644 index 0000000..48863a6 --- /dev/null +++ b/BlueWest.Authorization/Program.cs @@ -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(); diff --git a/BlueWest.Authorization/Properties/launchSettings.json b/BlueWest.Authorization/Properties/launchSettings.json new file mode 100644 index 0000000..6d1f5d4 --- /dev/null +++ b/BlueWest.Authorization/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:23917", + "sslPort": 44315 + } + }, + "profiles": { + "BlueWest.Authorization": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7246;http://localhost:5269", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/BlueWest.Authorization/WeatherForecast.cs b/BlueWest.Authorization/WeatherForecast.cs new file mode 100644 index 0000000..fb3694a --- /dev/null +++ b/BlueWest.Authorization/WeatherForecast.cs @@ -0,0 +1,12 @@ +namespace BlueWest.Authorization; + +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; } +} diff --git a/BlueWest.Authorization/appsettings.Development.json b/BlueWest.Authorization/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/BlueWest.Authorization/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/BlueWest.Authorization/appsettings.json b/BlueWest.Authorization/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/BlueWest.Authorization/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/BlueWest.Razor.Library/BlueWest.Razor.Library.csproj b/BlueWest.Razor.Library/BlueWest.Razor.Library.csproj new file mode 100644 index 0000000..66942bc --- /dev/null +++ b/BlueWest.Razor.Library/BlueWest.Razor.Library.csproj @@ -0,0 +1,18 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + diff --git a/BlueWest.Razor.Library/Component1.razor b/BlueWest.Razor.Library/Component1.razor new file mode 100644 index 0000000..51d3876 --- /dev/null +++ b/BlueWest.Razor.Library/Component1.razor @@ -0,0 +1,3 @@ + + This component is defined in the BlueWest.Razor.Library library. + \ No newline at end of file diff --git a/BlueWest.Razor.Library/Component1.razor.css b/BlueWest.Razor.Library/Component1.razor.css new file mode 100644 index 0000000..c6afca4 --- /dev/null +++ b/BlueWest.Razor.Library/Component1.razor.css @@ -0,0 +1,6 @@ +.my-component { + border: 2px dashed red; + padding: 1em; + margin: 1em 0; + background-image: url('background.png'); +} diff --git a/BlueWest.Razor.Library/ExampleJsInterop.cs b/BlueWest.Razor.Library/ExampleJsInterop.cs new file mode 100644 index 0000000..d1bac27 --- /dev/null +++ b/BlueWest.Razor.Library/ExampleJsInterop.cs @@ -0,0 +1,36 @@ +using Microsoft.JSInterop; + +namespace BlueWest.Razor.Library; + +// This class provides an example of how JavaScript functionality can be wrapped +// in a .NET class for easy consumption. The associated JavaScript module is +// loaded on demand when first needed. +// +// This class can be registered as scoped DI service and then injected into Blazor +// components for use. + +public class ExampleJsInterop : IAsyncDisposable +{ + private readonly Lazy> moduleTask; + + public ExampleJsInterop(IJSRuntime jsRuntime) + { + moduleTask = new(() => jsRuntime.InvokeAsync( + "import", "./_content/BlueWest.Razor.Library/exampleJsInterop.js").AsTask()); + } + + public async ValueTask Prompt(string message) + { + var module = await moduleTask.Value; + return await module.InvokeAsync("showPrompt", message); + } + + public async ValueTask DisposeAsync() + { + if (moduleTask.IsValueCreated) + { + var module = await moduleTask.Value; + await module.DisposeAsync(); + } + } +} \ No newline at end of file diff --git a/BlueWest.Razor.Library/_Imports.razor b/BlueWest.Razor.Library/_Imports.razor new file mode 100644 index 0000000..c3615ef --- /dev/null +++ b/BlueWest.Razor.Library/_Imports.razor @@ -0,0 +1 @@ +@using Microsoft.AspNetCore.Components.Web \ No newline at end of file diff --git a/BlueWest.Razor.Library/wwwroot/background.png b/BlueWest.Razor.Library/wwwroot/background.png new file mode 100644 index 0000000000000000000000000000000000000000..e15a3bde6e2bdb380df6a0b46d7ed00bdeb0aaa8 GIT binary patch literal 378 zcmeAS@N?(olHy`uVBq!ia0vp^x**KK1SGdsl%54rjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucLCF%=h?3y^w370~qEv>0#LT=By}Z;C1rt33 zJwr2>%=KS^ie7oTIEF;HpS|GCbyPusHSqiXaCu3qf)82(9Gq&mZq2{Kq}M*X&MWtJ zSi1Jo7ZzfImg%g=t(qo=wsSR2lZoP(Rj#3wacN=q0?Br(rXzgZEGK2$ID{|A=5S{xJEuzSH>!M+7wSY6hB<=-E^*n0W7 S8wY^CX7F_Nb6Mw<&;$S{dxtsz literal 0 HcmV?d00001 diff --git a/BlueWest.Razor.Library/wwwroot/exampleJsInterop.js b/BlueWest.Razor.Library/wwwroot/exampleJsInterop.js new file mode 100644 index 0000000..ea8d76a --- /dev/null +++ b/BlueWest.Razor.Library/wwwroot/exampleJsInterop.js @@ -0,0 +1,6 @@ +// This is a JavaScript module that is loaded on demand. It can export any number of +// functions, and may import other JavaScript modules if required. + +export function showPrompt(message) { + return prompt(message, 'Type anything here'); +} diff --git a/BlueWest.Views/BlueWest.Views.csproj b/BlueWest.Views/BlueWest.Views.csproj index 55d4277..2a7bff8 100644 --- a/BlueWest.Views/BlueWest.Views.csproj +++ b/BlueWest.Views/BlueWest.Views.csproj @@ -8,6 +8,10 @@ BlueWest.Views + + + + @@ -58,6 +62,37 @@ <_ContentIncludedByDefault Remove="wwwroot\lib\bootstrap\dist\js\bootstrap.min.js" /> <_ContentIncludedByDefault Remove="wwwroot\lib\bootstrap\dist\js\bootstrap.min.js.map" /> <_ContentIncludedByDefault Remove="wwwroot\lib\bootstrap\LICENSE" /> + <_ContentIncludedByDefault Remove="wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.js" /> + <_ContentIncludedByDefault Remove="wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.min.js" /> + <_ContentIncludedByDefault Remove="wwwroot\lib\jquery-validation-unobtrusive\LICENSE.txt" /> + <_ContentIncludedByDefault Remove="wwwroot\lib\jquery-validation\dist\additional-methods.js" /> + <_ContentIncludedByDefault Remove="wwwroot\lib\jquery-validation\dist\additional-methods.min.js" /> + <_ContentIncludedByDefault Remove="wwwroot\lib\jquery-validation\dist\jquery.validate.js" /> + <_ContentIncludedByDefault Remove="wwwroot\lib\jquery-validation\dist\jquery.validate.min.js" /> + <_ContentIncludedByDefault Remove="wwwroot\lib\jquery-validation\LICENSE.md" /> + <_ContentIncludedByDefault Remove="wwwroot\lib\jquery\dist\jquery.js" /> + <_ContentIncludedByDefault Remove="wwwroot\lib\jquery\dist\jquery.min.js" /> + <_ContentIncludedByDefault Remove="wwwroot\lib\jquery\dist\jquery.min.map" /> + <_ContentIncludedByDefault Remove="wwwroot\lib\jquery\LICENSE.txt" /> + <_ContentIncludedByDefault Remove="Views\Data\Roles\Index.cshtml" /> + + + + + + + + + true + PreserveNewest + PreserveNewest + + + + + + + diff --git a/BlueWest.Views/Controllers/AuthController.cs b/BlueWest.Views/Controllers/AuthController.cs new file mode 100644 index 0000000..95c9255 --- /dev/null +++ b/BlueWest.Views/Controllers/AuthController.cs @@ -0,0 +1,10 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Views.Controllers +{ + public class AuthController : Controller + { + + } +} + diff --git a/BlueWest.Views/Controllers/CapitalController.cs b/BlueWest.Views/Controllers/CapitalController.cs deleted file mode 100644 index ca39237..0000000 --- a/BlueWest.Views/Controllers/CapitalController.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Diagnostics; -using BlueWest.Views.Models; -using Microsoft.AspNetCore.Mvc; - -namespace BlueWest.Views.Controllers -{ - public class CapitalController : Controller - { - - public IActionResult Index() - { - return View(); - } - - - [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] - public IActionResult Error() - { - return View(new ErrorViewModel {RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier}); - } - } - -} - diff --git a/BlueWest.Views/Controllers/Data/BanksController.cs b/BlueWest.Views/Controllers/Data/BanksController.cs new file mode 100644 index 0000000..b062b04 --- /dev/null +++ b/BlueWest.Views/Controllers/Data/BanksController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Views.Controllers.Data; + +public class BanksController : Controller +{ + // GET + public IActionResult Index() + { + return View(); + } +} \ No newline at end of file diff --git a/BlueWest.Views/Controllers/Data/CompaniesController.cs b/BlueWest.Views/Controllers/Data/CompaniesController.cs new file mode 100644 index 0000000..4f71133 --- /dev/null +++ b/BlueWest.Views/Controllers/Data/CompaniesController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Views.Controllers; + +public class CompaniesController : Controller +{ + // GET + public IActionResult Index() + { + return View("../Data/Companies/Index"); + } +} \ No newline at end of file diff --git a/BlueWest.Views/Controllers/Data/CountriesController.cs b/BlueWest.Views/Controllers/Data/CountriesController.cs new file mode 100644 index 0000000..d63b2ff --- /dev/null +++ b/BlueWest.Views/Controllers/Data/CountriesController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Views.Controllers; + +public class CountriesController : Controller +{ + // GET + public IActionResult Index() + { + return View("../Data/Countries/Index"); + } +} \ No newline at end of file diff --git a/BlueWest.Views/Controllers/Data/CurrenciesController.cs b/BlueWest.Views/Controllers/Data/CurrenciesController.cs new file mode 100644 index 0000000..79ba8bd --- /dev/null +++ b/BlueWest.Views/Controllers/Data/CurrenciesController.cs @@ -0,0 +1,8 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Views.Controllers; + +public class CurrenciesController : Controller +{ + +} \ No newline at end of file diff --git a/BlueWest.Views/Controllers/Data/DataController.cs b/BlueWest.Views/Controllers/Data/DataController.cs new file mode 100644 index 0000000..b1b2cc3 --- /dev/null +++ b/BlueWest.Views/Controllers/Data/DataController.cs @@ -0,0 +1,17 @@ +using BlueWest.Views.Utils; +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Views.Controllers +{ + + public class DataController : Controller + { + public IActionResult Index() + { + this.HandleGlobalization(); + ViewData[FooterMenuId] = LayoutCache.DataRoute.Children; + return View(); + } + + } +} diff --git a/BlueWest.Views/Controllers/HomeController.cs b/BlueWest.Views/Controllers/HomeController.cs index bd553f0..6c626bb 100644 --- a/BlueWest.Views/Controllers/HomeController.cs +++ b/BlueWest.Views/Controllers/HomeController.cs @@ -1,31 +1,24 @@ -using System.Diagnostics; -using Microsoft.AspNetCore.Mvc; -using BlueWest.Views.Models; +using Microsoft.AspNetCore.Mvc; +using BlueWest.Views.Utils; +using Microsoft.Extensions.Options; +using Controller = Microsoft.AspNetCore.Mvc.Controller; namespace BlueWest.Views.Controllers; +[System.Web.Mvc.Route("/")] public class HomeController : Controller { private readonly ILogger _logger; - public HomeController(ILogger logger) + public HomeController(ILogger logger, IOptions options) { _logger = logger; } - + public IActionResult Index() { + this.HandleGlobalization(); return View(); } - public IActionResult Privacy() - { - return View(); - } - - [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] - public IActionResult Error() - { - return View(new ErrorViewModel {RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier}); - } } \ No newline at end of file diff --git a/BlueWest.Views/Controllers/JobsController.cs b/BlueWest.Views/Controllers/JobsController.cs new file mode 100644 index 0000000..f9fae66 --- /dev/null +++ b/BlueWest.Views/Controllers/JobsController.cs @@ -0,0 +1,33 @@ +using System.Diagnostics; +using System.Web.Mvc; +using Microsoft.AspNetCore.Mvc; +using BlueWest.Views.Models; +using BlueWest.Views.Utils; +using Controller = Microsoft.AspNetCore.Mvc.Controller; + +namespace BlueWest.Views.Controllers; + +public class JobsController : Controller +{ + private readonly ILogger _logger; + + public JobsController(ILogger logger) + { + _logger = logger; + } + + public IActionResult Index() + { + this.HandleGlobalization(); + ViewData["Title"] = "Home Page"; + + return View(); + } + + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel {RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier}); + } +} \ No newline at end of file diff --git a/BlueWest.Views/Controllers/System/ApplicationUsersController.cs b/BlueWest.Views/Controllers/System/ApplicationUsersController.cs new file mode 100644 index 0000000..2c8e8d2 --- /dev/null +++ b/BlueWest.Views/Controllers/System/ApplicationUsersController.cs @@ -0,0 +1,8 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Views.Controllers; + +public class ApplicationUsersController : Controller +{ + +} \ No newline at end of file diff --git a/BlueWest.Views/Controllers/System/DataUsersController.cs b/BlueWest.Views/Controllers/System/DataUsersController.cs new file mode 100644 index 0000000..4148341 --- /dev/null +++ b/BlueWest.Views/Controllers/System/DataUsersController.cs @@ -0,0 +1,8 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Views.Controllers; + +public class DataUsersController : Controller +{ + +} \ No newline at end of file diff --git a/BlueWest.Views/Controllers/System/LogsController.cs b/BlueWest.Views/Controllers/System/LogsController.cs new file mode 100644 index 0000000..cafb210 --- /dev/null +++ b/BlueWest.Views/Controllers/System/LogsController.cs @@ -0,0 +1,8 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Views.Controllers; + +public class LogsController : Controller +{ + +} \ No newline at end of file diff --git a/BlueWest.Views/Controllers/System/RolesController.cs b/BlueWest.Views/Controllers/System/RolesController.cs new file mode 100644 index 0000000..b3d3bb9 --- /dev/null +++ b/BlueWest.Views/Controllers/System/RolesController.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Views.Controllers; + +[System.Web.Mvc.Route($"{SystemRouteLocation}/roles")] + +public class RolesController : Controller +{ + // GET + public IActionResult Index() + { + return View("../System/Roles/Index"); + } +} \ No newline at end of file diff --git a/BlueWest.Views/Controllers/SystemController.cs b/BlueWest.Views/Controllers/System/SystemController.cs similarity index 78% rename from BlueWest.Views/Controllers/SystemController.cs rename to BlueWest.Views/Controllers/System/SystemController.cs index e379122..78dfafa 100644 --- a/BlueWest.Views/Controllers/SystemController.cs +++ b/BlueWest.Views/Controllers/System/SystemController.cs @@ -1,3 +1,4 @@ +using BlueWest.Views.Utils; using Microsoft.AspNetCore.Mvc; namespace BlueWest.Views.Controllers @@ -14,6 +15,8 @@ namespace BlueWest.Views.Controllers public IActionResult Index() { + this.HandleGlobalization(); + ViewData[FooterMenuId] = LayoutCache.SystemRoute.Children; return View(); } @@ -21,15 +24,6 @@ namespace BlueWest.Views.Controllers { return View(); } - - public IActionResult Roles() - { - return View(); - } - - - - } } diff --git a/BlueWest.Views/Controllers/UsersController.cs b/BlueWest.Views/Controllers/UsersController.cs new file mode 100644 index 0000000..af5bf4c --- /dev/null +++ b/BlueWest.Views/Controllers/UsersController.cs @@ -0,0 +1,8 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Views.Controllers; + +public class UsersController : Controller +{ + +} \ No newline at end of file diff --git a/BlueWest.Views/GlobalUsings.cs b/BlueWest.Views/GlobalUsings.cs new file mode 100644 index 0000000..7105e0b --- /dev/null +++ b/BlueWest.Views/GlobalUsings.cs @@ -0,0 +1,3 @@ +// Global using directives + +global using static BlueWest.Views.Utils.Routes; \ No newline at end of file diff --git a/BlueWest.Views/Languages/CultureSwitch.cs b/BlueWest.Views/Languages/CultureSwitch.cs new file mode 100644 index 0000000..01c7633 --- /dev/null +++ b/BlueWest.Views/Languages/CultureSwitch.cs @@ -0,0 +1,9 @@ +using System.Globalization; + +namespace BlueWest.Localization.Models; + +public class CultureSwitch +{ + public CultureInfo CurrentUICulture { get; set; } + public List SupportedCultures { get; set; } +} \ No newline at end of file diff --git a/BlueWest.Views/Languages/CultureSwitchViewComponent.cs b/BlueWest.Views/Languages/CultureSwitchViewComponent.cs new file mode 100644 index 0000000..cebde1f --- /dev/null +++ b/BlueWest.Views/Languages/CultureSwitchViewComponent.cs @@ -0,0 +1,27 @@ +using BlueWest.Localization.Models; +using Microsoft.AspNetCore.Localization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.Extensions.Options; + +namespace BlueWest.Views.Localization.ViewComponents; + +public class CultureSwitchViewComponent : ViewComponent +{ + private readonly IOptions localizationOptions; + public CultureSwitchViewComponent(IOptions localizationOptions) => + this.localizationOptions = localizationOptions; + + // public IViewComponentResult Invoke() + // { + // var cultureFeature = HttpContext.Features.Get(); + // var model = new CultureSwitch() + // { + // SupportedCultures = localizationOptions.Value.SupportedUICultures.ToList(), + // CurrentUICulture = cultureFeature.RequestCulture.UICulture + // }; + // return View(model); + // } + + +} \ No newline at end of file diff --git a/BlueWest.Views/Models/SystemPageModel.cs b/BlueWest.Views/Models/SystemPageModel.cs deleted file mode 100644 index c25a049..0000000 --- a/BlueWest.Views/Models/SystemPageModel.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace BlueWest.Views.Models -{ - public class SystemPageModel - { - - } -} - diff --git a/BlueWest.Views/Models/UserPageModel.cs b/BlueWest.Views/Models/UserPageModel.cs deleted file mode 100644 index 226c227..0000000 --- a/BlueWest.Views/Models/UserPageModel.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Microsoft.AspNetCore.Mvc.RazorPages; - -namespace BlueWest.Views.Models -{ - public class UserPageModel : PageModel - { - - } -} - diff --git a/BlueWest.Views/Program.cs b/BlueWest.Views/Program.cs index 5cd7c7e..8e2c1ce 100644 --- a/BlueWest.Views/Program.cs +++ b/BlueWest.Views/Program.cs @@ -1,6 +1,26 @@ +using BlueWest.Views.Utils; +using System.Globalization; +using Microsoft.AspNetCore.Authentication.Cookies; +using Microsoft.AspNetCore.Localization; +using Microsoft.Extensions.Options; + + var builder = WebApplication.CreateBuilder(args); +builder.Services.AddSingleton(); // Add services to the container. + +builder.Services.Configure(options => +{ + // This lambda determines whether user consent for non-essential cookies is needed for a given request. + options.CheckConsentNeeded = context => true; + options.MinimumSameSitePolicy = SameSiteMode.None; +}); +builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) + .AddCookie(cookieOptions => { + cookieOptions.LoginPath = "/"; +}); + builder.Services.AddControllersWithViews(); var app = builder.Build(); @@ -18,6 +38,14 @@ app.UseStaticFiles(); app.UseRouting(); +app.UseRequestLocalization(options => +{ + var supportedCultures = CultureInfo.GetCultures(CultureTypes.AllCultures); + options.DefaultRequestCulture = new RequestCulture("en-GB"); + options.SupportedCultures = supportedCultures; + options.SupportedUICultures = supportedCultures; +}); + app.UseAuthorization(); app.MapControllerRoute( diff --git a/BlueWest.Views/Utils/ControllerExtensions.cs b/BlueWest.Views/Utils/ControllerExtensions.cs new file mode 100644 index 0000000..7ed48f8 --- /dev/null +++ b/BlueWest.Views/Utils/ControllerExtensions.cs @@ -0,0 +1,27 @@ +using Microsoft.AspNetCore.Localization; +using Microsoft.AspNetCore.Mvc; + +namespace BlueWest.Views.Utils; + +public static class ControllerExtensions +{ + public static void HandleGlobalization(this Controller controller) + { + var context = controller.HttpContext; + var requestCultureFeature = context.Features.Get(); + var currentCultureName = Routes.DefaultCultureName; + if (requestCultureFeature != null) + { + currentCultureName = requestCultureFeature.RequestCulture.Culture.Name; + } + + controller.ViewData[LanguageViewStorage] = currentCultureName; + } + + public static void HandlePageName(this Controller controller, string location) + { + + } + + +} \ No newline at end of file diff --git a/BlueWest.Views/Utils/LayoutCache.cs b/BlueWest.Views/Utils/LayoutCache.cs new file mode 100644 index 0000000..32ad35a --- /dev/null +++ b/BlueWest.Views/Utils/LayoutCache.cs @@ -0,0 +1,180 @@ +using BlueWest.Views.Controllers; +using BlueWest.Views.Controllers.Data; +using Microsoft.AspNetCore.Mvc.ViewFeatures; + +namespace BlueWest.Views.Utils; + +internal class LayoutCache +{ + #region Route Tree + + private static readonly RouteRecord Root = new RouteRecord( + RootKeyName, + RootLocation, + nameof(HomeController), + new List() + { + new RouteRecord( + DataKeyName, + DataLocation, + nameof(DataController), + new List() + { + new RouteRecord( + CompaniesKeyName, + CompaniesLocation, + nameof(CompaniesController), + new List() + ), + new RouteRecord( + CountriesKeyName, + CountriesLocation, + nameof(CountriesController), + new List() + ), + new RouteRecord( + CurrenciesKeyName, + CurrenciesLocation, + nameof(CurrenciesController), + new List() + ), + new RouteRecord( + BanksKeyName, + BanksLocation, + nameof(BanksController), + new List() + ), + new RouteRecord( + DataUsersKeyName, + DataUsersLocation, + nameof(DataUsersController), + new List() + ), + + }, + ViewType.Data + ), + new RouteRecord( + SystemKeyName, + SystemRouteLocation, + nameof(SystemController), + new List() + { + new RouteRecord( + RolesKeyName, + RolesLocation, + nameof(RolesController), + new List() + ), + new RouteRecord( + ApplicationUsersKeyName, + ApplicationUsersLocation, + nameof(ApplicationUsersController), + new List() + ), + new RouteRecord( + LogsKeyName, + LogsLocation, + nameof(LogsController), + new List() + ) + }, + ViewType.System + ), + new RouteRecord( + JobsKeyName, + JobsRouteLocation, + nameof(JobsController), + new List(), + ViewType.Jobs + ), + }, ViewType.Root); + + #endregion Route Tree + + #region Routing Utils + + internal static readonly RouteRecord SystemRoute = + Root.Children.FirstOrDefault(x => x.ViewType == ViewType.System)!; + + internal static readonly RouteRecord DataRoute = + Root.Children.FirstOrDefault(x => x.ViewType == ViewType.Data)!; + + internal static readonly RouteRecord JobRoute = + Root.Children.FirstOrDefault(x => x.ViewType == ViewType.Jobs)!; + + internal static readonly RouteRecord ProfileRoute = + Root.Children.FirstOrDefault(x => x.ViewType == ViewType.Profile)!; + + #endregion Routing Utils + + #region Internal Menus + + internal static List GetDefaultFooterMenu(ViewDataDictionary dictionary) + { + var location = GetLocation(dictionary); + + var menu = LayoutCache + .Root + .Children; + + if (dictionary[FooterMenuId] is List footerMenu) + { + menu = footerMenu; + } + + return menu + .Select(x => + { + if (Translation[x.routeKey].ContainsKey(location)) + { + return new RouteView(Translation[x.routeKey][location], + location); + } + return new RouteView(Translation[x.routeKey][DefaultCultureName], + x.location); + + }) + + .ToList(); + + } + + internal static List GetDefaultHeaderMenu(ViewDataDictionary dictionary) + { + var location = GetLocation(dictionary); + + var menu = LayoutCache + .Root + .Children; + + if (dictionary[HeaderMenuId] is List footerMenu) + { + menu = footerMenu; + } + + return menu + .Select(x => + { + if (Translation[x.routeKey].ContainsKey(location)) + { + return new RouteView(Translation[x.routeKey][location], + x.Location); + } + return new RouteView(Translation[x.routeKey][DefaultCultureName], + x.location); + + }) + + .ToList(); + } + + internal static string GetLocation(ViewDataDictionary dictionary) + { + return (dictionary[LanguageViewStorage] as string)!; + } + + + #endregion Internal Menus + +} \ No newline at end of file diff --git a/BlueWest.Views/Utils/LinkViewInformation.cs b/BlueWest.Views/Utils/LinkViewInformation.cs new file mode 100644 index 0000000..58327f6 --- /dev/null +++ b/BlueWest.Views/Utils/LinkViewInformation.cs @@ -0,0 +1,13 @@ +namespace BlueWest.Views.Utils; + +public record LinkViewInformation +{ + public string Location; + public string Name; + + public LinkViewInformation(LinkViewInformation linkInformation) + { + Location = linkInformation.Location; + Name = linkInformation.Name; + } +} \ No newline at end of file diff --git a/BlueWest.Views/Utils/Menus.cs b/BlueWest.Views/Utils/Menus.cs new file mode 100644 index 0000000..e66bd30 --- /dev/null +++ b/BlueWest.Views/Utils/Menus.cs @@ -0,0 +1,7 @@ +namespace BlueWest.Views.Utils.Static; + +public static class Menus +{ + internal const string FooterMenuId = "m1"; + internal const string HeaderMenuId = "m2"; +} \ No newline at end of file diff --git a/BlueWest.Views/Utils/RouteRecord.cs b/BlueWest.Views/Utils/RouteRecord.cs new file mode 100644 index 0000000..7cf9220 --- /dev/null +++ b/BlueWest.Views/Utils/RouteRecord.cs @@ -0,0 +1,14 @@ +namespace BlueWest.Views.Utils +{ + public record RouteRecord(string routeKey, string location, string controllerName, List children, ViewType viewType = ViewType.Undefined) + { + public string RouteKey = routeKey; + public string Location = location; + public string ControllerName; + public List Children = children; + public ViewType ViewType = viewType; + } + + public record RouteView(string Name, string Location); +} + diff --git a/BlueWest.Views/Utils/Routes.cs b/BlueWest.Views/Utils/Routes.cs new file mode 100644 index 0000000..5bcbe8d --- /dev/null +++ b/BlueWest.Views/Utils/Routes.cs @@ -0,0 +1,190 @@ +using System.Collections.Immutable; + +namespace BlueWest.Views.Utils +{ + internal static class Routes + { + public const string DefaultCultureName = "en-gb"; + + #region Layout Keys + + internal const string FooterMenuId = "m1"; + internal const string HeaderMenuId = "m2"; + internal const string LanguageViewStorage = "i80"; + + #endregion Layout Keys + + #region Route Keys + + internal const string DataKeyName = "data"; + internal const string RootKeyName = "root"; + internal const string RootLocation = "/"; + + internal const string SystemKeyName = "system"; + internal const string RolesKeyName = "roles"; + internal const string CompaniesKeyName = "companies"; + internal const string CountriesKeyName = "countries"; + internal const string CurrenciesKeyName = "currencies"; + internal const string IndustriesKeyName = "industries"; + internal const string DataUsersKeyName = "users"; + internal const string BanksKeyName = "banks"; + internal const string JobsKeyName = "jobs"; + internal const string SettingsKeyName = "settings"; + internal const string LogsKeyName = "logs"; + internal const string ApplicationUsersKeyName = "app_users"; + + #endregion Route Keys + // Translation Database Keys + + #region Routes Data + + // Routes + internal const string RolesLocation = $"{SystemRouteLocation}/roles"; + internal const string ApplicationUsersLocation = $"{SystemRouteLocation}/users"; + internal const string LogsLocation = $"{SystemRouteLocation}/logs"; + internal const string SettingsRouteLocation = $"{SystemRouteLocation}/settings"; + internal const string DataLocation = $"/data"; + + + // Banks + + // Data users + internal const string DataUsersLocation = "/data/users"; + internal const string JobsRouteLocation = "/jobs"; + internal const string SystemRouteLocation = $"/system"; + internal const string BanksLocation = $"{DataLocation}/banks"; + internal const string CountriesLocation = $"{DataLocation}/countries"; + internal const string CurrenciesLocation = $"{DataLocation}/currencies"; + + internal const string CompaniesLocation = $"{DataLocation}/companies"; + internal const string IndustriesLocation = $"{DataLocation}/industries"; + + + #endregion Routes Data + + internal static Dictionary> Translation = + new Dictionary> + { + { + RootKeyName, new Dictionary() + { + {"pt", "Inicio"}, + {"eng", "Home"}, + {"en-gb", "Home"} + } + }, + { + SystemKeyName, new Dictionary() + { + {"pt", "Sistema"}, + {"eng", "System"}, + {"en-gb", "System"}, + } + }, + { + DataKeyName, new Dictionary() + { + {"pt", "Dados"}, + {"eng", "Data"}, + {"en-gb", "Data"} + } + }, + + { + RolesKeyName, new Dictionary() + { + {"pt", "Tipos de Utilizador"}, + {"en-gb", "Roles"}, + {"eng", "Roles"} + } + }, + { + ApplicationUsersKeyName, new Dictionary() + { + {"pt", "Utilizadores da Aplicação"}, + {"en-gb", "Users"}, + {"eng", "Users"} + } + }, + { + LogsKeyName, new Dictionary() + { + {"pt", "Logs"}, + {"en-gb", "logs"}, + {"eng", "logs"} + } + }, + { + SettingsKeyName, new Dictionary() + { + {"pt", "Personalização"}, + {"eng", "Settings"}, + {"en-gb", "Settings"}, + } + }, + { + CompaniesKeyName, new Dictionary() + { + {"pt", "Empresas"}, + {"eng", "Companies"}, + {"en-gb", "Companies"}, + } + }, + + { + IndustriesKeyName, new Dictionary() + { + {"pt", "Indústrias"}, + {"en-gb", "Industries"}, + {"eng", "Industries"}, + } + }, + + { + CurrenciesKeyName, new Dictionary() + { + {"pt", "Moedas"}, + {"en-gb", "Currencies"}, + {"eng", "Currencies"}, + } + }, + { + CountriesKeyName, new Dictionary() + { + {"pt", "Países"}, + {"eng", "Countries"}, + {"en-gb", "Countries"} + } + }, + + { + BanksKeyName, new Dictionary() + { + {"pt", "Bancos"}, + {"eng", "Banks"}, + {"en-gb", "Banks"}, + } + }, + + + { + DataUsersKeyName, new Dictionary() + { + {"pt", "Utilizadores"}, + {"eng", "Users"}, + {"en-gb", "Users"}, + } + }, + + { + JobsKeyName, new Dictionary() + { + {"pt", "Anúncios de trabalho"}, + {"eng", "Jobs"}, + {"en-gb", "Jobs"}, + } + }, + }; + + } +} \ No newline at end of file diff --git a/BlueWest.Views/Utils/ViewType.cs b/BlueWest.Views/Utils/ViewType.cs new file mode 100644 index 0000000..9792d33 --- /dev/null +++ b/BlueWest.Views/Utils/ViewType.cs @@ -0,0 +1,16 @@ +using System.Collections.Immutable; + +namespace BlueWest.Views +{ + public enum ViewType + { + System, + Data, + Jobs, + Profile, + Root, + Undefined + + } +} + diff --git a/BlueWest.Views/Views/Banks/Index.cshtml b/BlueWest.Views/Views/Banks/Index.cshtml new file mode 100644 index 0000000..64fcda5 --- /dev/null +++ b/BlueWest.Views/Views/Banks/Index.cshtml @@ -0,0 +1,18 @@ +@model dynamic + +@{ + Layout = null; +} + + + + + + title + + + + + + + \ No newline at end of file diff --git a/BlueWest.Views/Views/Capital/Index.cshtml b/BlueWest.Views/Views/Capital/Index.cshtml deleted file mode 100644 index d69d51d..0000000 --- a/BlueWest.Views/Views/Capital/Index.cshtml +++ /dev/null @@ -1,8 +0,0 @@ -@{ - ViewData["Title"] = "Home Page"; -} - - - Capital - Learn about building Web apps with ASP.NET Core. - \ No newline at end of file diff --git a/BlueWest.Views/Views/Data/Companies/Index.cshtml b/BlueWest.Views/Views/Data/Companies/Index.cshtml new file mode 100644 index 0000000..7ab5168 --- /dev/null +++ b/BlueWest.Views/Views/Data/Companies/Index.cshtml @@ -0,0 +1,11 @@ +@using BlueWest.Views.Utils +@{ + ViewData["Title"] = "Home Page"; +} + + + Companies Module + + + +@Html.Partial("_FooterMenu"); \ No newline at end of file diff --git a/BlueWest.Views/Views/Data/Countries/Index.cshtml b/BlueWest.Views/Views/Data/Countries/Index.cshtml new file mode 100644 index 0000000..9cadfef --- /dev/null +++ b/BlueWest.Views/Views/Data/Countries/Index.cshtml @@ -0,0 +1,11 @@ +@using BlueWest.Views.Utils +@{ + ViewData["Title"] = "Home Page"; +} + + + Data Module + + + +@Html.Partial("_FooterMenu"); \ No newline at end of file diff --git a/BlueWest.Views/Views/Data/Index.cshtml b/BlueWest.Views/Views/Data/Index.cshtml new file mode 100644 index 0000000..9cadfef --- /dev/null +++ b/BlueWest.Views/Views/Data/Index.cshtml @@ -0,0 +1,11 @@ +@using BlueWest.Views.Utils +@{ + ViewData["Title"] = "Home Page"; +} + + + Data Module + + + +@Html.Partial("_FooterMenu"); \ No newline at end of file diff --git a/BlueWest.Views/Views/Home/Index.cshtml b/BlueWest.Views/Views/Home/Index.cshtml index 378bcad..9ff16ec 100644 --- a/BlueWest.Views/Views/Home/Index.cshtml +++ b/BlueWest.Views/Views/Home/Index.cshtml @@ -1,8 +1,32 @@ -@{ +@using Microsoft.AspNetCore.Localization +@{ ViewData["Title"] = "Home Page"; + } + Welcome Learn about building Web apps with ASP.NET Core. - \ No newline at end of file + + + + Date + @DateTime.Now.ToLongDateString() + + + Currency + + @(12345.00.ToString("c")) + + + + Number + + @(123.45m.ToString("F2")) + + + + + + diff --git a/BlueWest.Views/Views/Jobs/Index.cshtml b/BlueWest.Views/Views/Jobs/Index.cshtml new file mode 100644 index 0000000..15108b4 --- /dev/null +++ b/BlueWest.Views/Views/Jobs/Index.cshtml @@ -0,0 +1,10 @@ +@{ + ViewData["Title"] = "Home Page"; +} + + + Data Module + + + +@Html.Partial("_FooterMenu"); \ No newline at end of file diff --git a/BlueWest.Views/Views/Shared/UsersMenu.cshtml b/BlueWest.Views/Views/Shared/UsersMenu.cshtml new file mode 100644 index 0000000..d223537 --- /dev/null +++ b/BlueWest.Views/Views/Shared/UsersMenu.cshtml @@ -0,0 +1,59 @@ + \ No newline at end of file diff --git a/BlueWest.Views/Views/Shared/_FooterMenu.cshtml b/BlueWest.Views/Views/Shared/_FooterMenu.cshtml new file mode 100644 index 0000000..38340e1 --- /dev/null +++ b/BlueWest.Views/Views/Shared/_FooterMenu.cshtml @@ -0,0 +1,31 @@ +@using BlueWest.Views.Utils +@{ + Layout = null; + var menu = LayoutCache.GetDefaultFooterMenu(ViewData); +} + + \ No newline at end of file diff --git a/BlueWest.Views/Views/Shared/_HeaderMenu.cshtml b/BlueWest.Views/Views/Shared/_HeaderMenu.cshtml index 4c181fe..e3da6c8 100644 --- a/BlueWest.Views/Views/Shared/_HeaderMenu.cshtml +++ b/BlueWest.Views/Views/Shared/_HeaderMenu.cshtml @@ -1 +1,23 @@ -BlueWest.Views +@using BlueWest.Views.Utils +@{ + Layout = null; + var menu = LayoutCache.GetDefaultHeaderMenu(ViewData); +} + + + + @if (menu is {Count: > 0 }) + { + @foreach (var record in menu) + { + + + @record.Name + + + + } + } + + + \ No newline at end of file diff --git a/BlueWest.Views/Views/Shared/_Layout.cshtml b/BlueWest.Views/Views/Shared/_Layout.cshtml index a12d29d..11d3916 100644 --- a/BlueWest.Views/Views/Shared/_Layout.cshtml +++ b/BlueWest.Views/Views/Shared/_Layout.cshtml @@ -5,70 +5,39 @@ @ViewData["Title"] - BlueWest.Views + @* - + *@ + + - + @RenderBody() + - - - - - System - - - Capital - - - - - - + + @await Html.PartialAsync("_HeaderMenu") + - - @RenderBody() - - + + + @RenderBody() + + - - @await RenderSectionAsync("Scripts", required: false)
Learn about building Web apps with ASP.NET Core.