diff --git a/eShopOnWeb.sln b/eShopOnWeb.sln index 435595fa6..5742f2e59 100755 --- a/eShopOnWeb.sln +++ b/eShopOnWeb.sln @@ -34,7 +34,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublicApi", "src\PublicApi\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorAdmin", "src\BlazorAdmin\BlazorAdmin.csproj", "{71368733-80A4-4869-B215-3A7001878577}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shared", "src\Shared\Shared.csproj", "{7BDB419E-FAC1-4D43-8AA9-FB61EBE31BB8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorShared", "src\BlazorShared\BlazorShared.csproj", "{715CF7AF-A1EE-40A6-94A0-8DA3F3B2CAE9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -78,10 +78,10 @@ Global {71368733-80A4-4869-B215-3A7001878577}.Debug|Any CPU.Build.0 = Debug|Any CPU {71368733-80A4-4869-B215-3A7001878577}.Release|Any CPU.ActiveCfg = Release|Any CPU {71368733-80A4-4869-B215-3A7001878577}.Release|Any CPU.Build.0 = Release|Any CPU - {7BDB419E-FAC1-4D43-8AA9-FB61EBE31BB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7BDB419E-FAC1-4D43-8AA9-FB61EBE31BB8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7BDB419E-FAC1-4D43-8AA9-FB61EBE31BB8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7BDB419E-FAC1-4D43-8AA9-FB61EBE31BB8}.Release|Any CPU.Build.0 = Release|Any CPU + {715CF7AF-A1EE-40A6-94A0-8DA3F3B2CAE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {715CF7AF-A1EE-40A6-94A0-8DA3F3B2CAE9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {715CF7AF-A1EE-40A6-94A0-8DA3F3B2CAE9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {715CF7AF-A1EE-40A6-94A0-8DA3F3B2CAE9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -95,7 +95,7 @@ Global {7EFB5482-F942-4C3D-94B0-9B70596E6D0A} = {15EA4737-125B-4E6E-A806-E13B7EBCDCCF} {B5E4F33C-4667-4A55-AF6A-740F84C4CF3A} = {419A6ACE-0419-4315-A6FB-B0E63D39432E} {71368733-80A4-4869-B215-3A7001878577} = {419A6ACE-0419-4315-A6FB-B0E63D39432E} - {7BDB419E-FAC1-4D43-8AA9-FB61EBE31BB8} = {419A6ACE-0419-4315-A6FB-B0E63D39432E} + {715CF7AF-A1EE-40A6-94A0-8DA3F3B2CAE9} = {419A6ACE-0419-4315-A6FB-B0E63D39432E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {49813262-5DA3-4D61-ABD3-493C74CE8C2B} diff --git a/src/ApplicationCore/ApplicationCore.csproj b/src/ApplicationCore/ApplicationCore.csproj index 8e8906c49..11dff61c1 100644 --- a/src/ApplicationCore/ApplicationCore.csproj +++ b/src/ApplicationCore/ApplicationCore.csproj @@ -13,4 +13,8 @@ + + + + \ No newline at end of file diff --git a/src/ApplicationCore/Constants/AuthorizationConstants.cs b/src/ApplicationCore/Constants/AuthorizationConstants.cs index c2d14c8e6..6c48ff2cc 100644 --- a/src/ApplicationCore/Constants/AuthorizationConstants.cs +++ b/src/ApplicationCore/Constants/AuthorizationConstants.cs @@ -2,10 +2,6 @@ { public class AuthorizationConstants { - public static class Roles - { - public const string ADMINISTRATORS = "Administrators"; - } // TODO: Don't use this in production public const string DEFAULT_PASSWORD = "Pass@word1"; diff --git a/src/BlazorAdmin/BlazorAdmin.csproj b/src/BlazorAdmin/BlazorAdmin.csproj index 84a9a3806..9867426a3 100644 --- a/src/BlazorAdmin/BlazorAdmin.csproj +++ b/src/BlazorAdmin/BlazorAdmin.csproj @@ -18,7 +18,7 @@ - + diff --git a/src/BlazorAdmin/Constants.cs b/src/BlazorAdmin/Constants.cs index ae930e549..0ff40f70b 100644 --- a/src/BlazorAdmin/Constants.cs +++ b/src/BlazorAdmin/Constants.cs @@ -3,10 +3,5 @@ public class Constants { public const string API_URL = "https://localhost:5099/api/"; - - public static class Roles - { - public const string ADMINISTRATORS = "Administrators"; - } } } diff --git a/src/BlazorAdmin/CustomAuthStateProvider.cs b/src/BlazorAdmin/CustomAuthStateProvider.cs index bdf4dd51a..af6092ed7 100644 --- a/src/BlazorAdmin/CustomAuthStateProvider.cs +++ b/src/BlazorAdmin/CustomAuthStateProvider.cs @@ -4,7 +4,7 @@ using System.Security.Claims; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using Shared.Authorization; +using BlazorShared.Authorization; namespace BlazorAdmin { diff --git a/src/BlazorAdmin/Pages/CatalogItemPage/Create.razor b/src/BlazorAdmin/Pages/CatalogItemPage/Create.razor index 7c866803b..adecc769c 100644 --- a/src/BlazorAdmin/Pages/CatalogItemPage/Create.razor +++ b/src/BlazorAdmin/Pages/CatalogItemPage/Create.razor @@ -118,7 +118,7 @@ private async Task CreateClick() { - await new BlazorAdmin.Services.CatalogItemService.Create(Auth).HandleAsync(_item); + await new BlazorAdmin.Services.CatalogItemServices.Create(Auth).HandleAsync(_item); await OnCloseClick.InvokeAsync(null); Close(); } diff --git a/src/BlazorAdmin/Pages/CatalogItemPage/Delete.razor b/src/BlazorAdmin/Pages/CatalogItemPage/Delete.razor index 82bb464e9..d64316749 100644 --- a/src/BlazorAdmin/Pages/CatalogItemPage/Delete.razor +++ b/src/BlazorAdmin/Pages/CatalogItemPage/Delete.razor @@ -47,7 +47,7 @@
- @Services.CatalogBrandService.List.GetBrandName(Brands, _item.CatalogBrandId) + @Services.CatalogBrandServices.List.GetBrandName(Brands, _item.CatalogBrandId)
@@ -55,7 +55,7 @@
- @Services.CatalogTypeService.List.GetTypeName(Types, _item.CatalogTypeId) + @Services.CatalogTypeServices.List.GetTypeName(Types, _item.CatalogTypeId)
Price @@ -105,7 +105,7 @@ { // TODO: Add some kind of "are you sure" check before this - await new BlazorAdmin.Services.CatalogItemService.Delete(Auth).HandleAsync(id); + await new BlazorAdmin.Services.CatalogItemServices.Delete(Auth).HandleAsync(id); await OnCloseClick.InvokeAsync(null); Close(); diff --git a/src/BlazorAdmin/Pages/CatalogItemPage/Details.razor b/src/BlazorAdmin/Pages/CatalogItemPage/Details.razor index 12c89561d..1539ee6d1 100644 --- a/src/BlazorAdmin/Pages/CatalogItemPage/Details.razor +++ b/src/BlazorAdmin/Pages/CatalogItemPage/Details.razor @@ -50,7 +50,7 @@
- @Services.CatalogBrandService.List.GetBrandName(Brands, _item.CatalogBrandId) + @Services.CatalogBrandServices.List.GetBrandName(Brands, _item.CatalogBrandId)
@@ -58,7 +58,7 @@
- @Services.CatalogTypeService.List.GetTypeName(Types, _item.CatalogTypeId) + @Services.CatalogTypeServices.List.GetTypeName(Types, _item.CatalogTypeId)
Price diff --git a/src/BlazorAdmin/Pages/CatalogItemPage/Edit.razor b/src/BlazorAdmin/Pages/CatalogItemPage/Edit.razor index 4a193ee6c..4e9fd24c5 100644 --- a/src/BlazorAdmin/Pages/CatalogItemPage/Edit.razor +++ b/src/BlazorAdmin/Pages/CatalogItemPage/Edit.razor @@ -118,7 +118,7 @@ private async Task SaveClick() { - await new BlazorAdmin.Services.CatalogItemService.Edit(Auth).HandleAsync(_item); + await new BlazorAdmin.Services.CatalogItemServices.Edit(Auth).HandleAsync(_item); Close(); } diff --git a/src/BlazorAdmin/Pages/CatalogItemPage/List.razor b/src/BlazorAdmin/Pages/CatalogItemPage/List.razor index 90125a009..d0de45097 100644 --- a/src/BlazorAdmin/Pages/CatalogItemPage/List.razor +++ b/src/BlazorAdmin/Pages/CatalogItemPage/List.razor @@ -1,7 +1,7 @@ @page "/admin" -@attribute [Authorize(Roles = Constants.Roles.ADMINISTRATORS)] +@attribute [Authorize(Roles = BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS)] @inject AuthService Auth -@using global::Shared.Authorization +@using global::BlazorShared.Authorization @inherits BlazorAdmin.Helpers.BlazorComponent @namespace BlazorAdmin.Pages.CatalogItemPage @@ -40,8 +40,8 @@ else - @Services.CatalogTypeService.List.GetTypeName(catalogTypes, item.CatalogTypeId) - @Services.CatalogBrandService.List.GetBrandName(catalogBrands, item.CatalogBrandId) + @Services.CatalogTypeServices.List.GetTypeName(catalogTypes, item.CatalogTypeId) + @Services.CatalogBrandServices.List.GetBrandName(catalogBrands, item.CatalogBrandId) @item.Id @item.Name @item.Description diff --git a/src/BlazorAdmin/Pages/CatalogItemPage/List.razor.cs b/src/BlazorAdmin/Pages/CatalogItemPage/List.razor.cs index a37fa02bf..21cbe2d6f 100644 --- a/src/BlazorAdmin/Pages/CatalogItemPage/List.razor.cs +++ b/src/BlazorAdmin/Pages/CatalogItemPage/List.razor.cs @@ -1,7 +1,7 @@ using BlazorAdmin.Helpers; -using BlazorAdmin.Services.CatalogBrandService; -using BlazorAdmin.Services.CatalogItemService; -using BlazorAdmin.Services.CatalogTypeService; +using BlazorAdmin.Services.CatalogBrandServices; +using BlazorAdmin.Services.CatalogItemServices; +using BlazorAdmin.Services.CatalogTypeServices; using System.Collections.Generic; using System.Threading.Tasks; @@ -22,9 +22,9 @@ protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { - catalogItems = await new BlazorAdmin.Services.CatalogItemService.ListPaged(Auth).HandleAsync(50); - catalogTypes = await new BlazorAdmin.Services.CatalogTypeService.List(Auth).HandleAsync(); - catalogBrands = await new BlazorAdmin.Services.CatalogBrandService.List(Auth).HandleAsync(); + catalogItems = await new BlazorAdmin.Services.CatalogItemServices.ListPaged(Auth).HandleAsync(50); + catalogTypes = await new BlazorAdmin.Services.CatalogTypeServices.List(Auth).HandleAsync(); + catalogBrands = await new BlazorAdmin.Services.CatalogBrandServices.List(Auth).HandleAsync(); CallRequestRefresh(); } @@ -54,7 +54,7 @@ private async Task DeleteClick(int id) private async Task ReloadCatalogItems() { - catalogItems = await new BlazorAdmin.Services.CatalogItemService.ListPaged(Auth).HandleAsync(50); + catalogItems = await new BlazorAdmin.Services.CatalogItemServices.ListPaged(Auth).HandleAsync(50); StateHasChanged(); } } diff --git a/src/BlazorAdmin/Services/AuthService.cs b/src/BlazorAdmin/Services/AuthService.cs index 12bda0a59..714ef319e 100644 --- a/src/BlazorAdmin/Services/AuthService.cs +++ b/src/BlazorAdmin/Services/AuthService.cs @@ -11,7 +11,7 @@ using Blazored.LocalStorage; using Microsoft.JSInterop; using Newtonsoft.Json; -using Shared.Authorization; +using BlazorShared.Authorization; namespace BlazorAdmin.Services { diff --git a/src/BlazorAdmin/Services/CatalogBrandService/List.CatalogBrand.cs b/src/BlazorAdmin/Services/CatalogBrandServices/List.CatalogBrand.cs similarity index 69% rename from src/BlazorAdmin/Services/CatalogBrandService/List.CatalogBrand.cs rename to src/BlazorAdmin/Services/CatalogBrandServices/List.CatalogBrand.cs index b535633e3..b8d8a5b99 100644 --- a/src/BlazorAdmin/Services/CatalogBrandService/List.CatalogBrand.cs +++ b/src/BlazorAdmin/Services/CatalogBrandServices/List.CatalogBrand.cs @@ -1,4 +1,4 @@ -namespace BlazorAdmin.Services.CatalogBrandService +namespace BlazorAdmin.Services.CatalogBrandServices { public class CatalogBrand { diff --git a/src/BlazorAdmin/Services/CatalogBrandService/List.CatalogBrandResult.cs b/src/BlazorAdmin/Services/CatalogBrandServices/List.CatalogBrandResult.cs similarity index 77% rename from src/BlazorAdmin/Services/CatalogBrandService/List.CatalogBrandResult.cs rename to src/BlazorAdmin/Services/CatalogBrandServices/List.CatalogBrandResult.cs index 18f621996..88493eaf4 100644 --- a/src/BlazorAdmin/Services/CatalogBrandService/List.CatalogBrandResult.cs +++ b/src/BlazorAdmin/Services/CatalogBrandServices/List.CatalogBrandResult.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace BlazorAdmin.Services.CatalogBrandService +namespace BlazorAdmin.Services.CatalogBrandServices { public class CatalogBrandResult { diff --git a/src/BlazorAdmin/Services/CatalogBrandService/List.cs b/src/BlazorAdmin/Services/CatalogBrandServices/List.cs similarity index 96% rename from src/BlazorAdmin/Services/CatalogBrandService/List.cs rename to src/BlazorAdmin/Services/CatalogBrandServices/List.cs index be4cd6803..fc7b7eeb2 100644 --- a/src/BlazorAdmin/Services/CatalogBrandService/List.cs +++ b/src/BlazorAdmin/Services/CatalogBrandServices/List.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Components.WebAssembly.Authentication; using Newtonsoft.Json; -namespace BlazorAdmin.Services.CatalogBrandService +namespace BlazorAdmin.Services.CatalogBrandServices { public class List { diff --git a/src/BlazorAdmin/Services/CatalogItemService/CatalogItem.cs b/src/BlazorAdmin/Services/CatalogItemServices/CatalogItem.cs similarity index 93% rename from src/BlazorAdmin/Services/CatalogItemService/CatalogItem.cs rename to src/BlazorAdmin/Services/CatalogItemServices/CatalogItem.cs index 5be1da1fe..d47c53eb2 100644 --- a/src/BlazorAdmin/Services/CatalogItemService/CatalogItem.cs +++ b/src/BlazorAdmin/Services/CatalogItemServices/CatalogItem.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace BlazorAdmin.Services.CatalogItemService +namespace BlazorAdmin.Services.CatalogItemServices { public class CatalogItem { diff --git a/src/BlazorAdmin/Services/CatalogItemService/Create.CreateCatalogItemRequest.cs b/src/BlazorAdmin/Services/CatalogItemServices/Create.CreateCatalogItemRequest.cs similarity index 93% rename from src/BlazorAdmin/Services/CatalogItemService/Create.CreateCatalogItemRequest.cs rename to src/BlazorAdmin/Services/CatalogItemServices/Create.CreateCatalogItemRequest.cs index 377ded062..b9d09cb02 100644 --- a/src/BlazorAdmin/Services/CatalogItemService/Create.CreateCatalogItemRequest.cs +++ b/src/BlazorAdmin/Services/CatalogItemServices/Create.CreateCatalogItemRequest.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace BlazorAdmin.Services.CatalogItemService +namespace BlazorAdmin.Services.CatalogItemServices { public class CreateCatalogItemRequest { diff --git a/src/BlazorAdmin/Services/CatalogItemService/Create.CreateCatalogItemResult.cs b/src/BlazorAdmin/Services/CatalogItemServices/Create.CreateCatalogItemResult.cs similarity index 81% rename from src/BlazorAdmin/Services/CatalogItemService/Create.CreateCatalogItemResult.cs rename to src/BlazorAdmin/Services/CatalogItemServices/Create.CreateCatalogItemResult.cs index 71d68fee4..f76fe3f87 100644 --- a/src/BlazorAdmin/Services/CatalogItemService/Create.CreateCatalogItemResult.cs +++ b/src/BlazorAdmin/Services/CatalogItemServices/Create.CreateCatalogItemResult.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading.Tasks; -namespace BlazorAdmin.Services.CatalogItemService +namespace BlazorAdmin.Services.CatalogItemServices { public class CreateCatalogItemResult { diff --git a/src/BlazorAdmin/Services/CatalogItemService/Create.cs b/src/BlazorAdmin/Services/CatalogItemServices/Create.cs similarity index 95% rename from src/BlazorAdmin/Services/CatalogItemService/Create.cs rename to src/BlazorAdmin/Services/CatalogItemServices/Create.cs index ac37d82d2..c9fe760db 100644 --- a/src/BlazorAdmin/Services/CatalogItemService/Create.cs +++ b/src/BlazorAdmin/Services/CatalogItemServices/Create.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Newtonsoft.Json; -namespace BlazorAdmin.Services.CatalogItemService +namespace BlazorAdmin.Services.CatalogItemServices { public class Create { diff --git a/src/BlazorAdmin/Services/CatalogItemService/Delete.DeleteCatalogItemResult.cs b/src/BlazorAdmin/Services/CatalogItemServices/Delete.DeleteCatalogItemResult.cs similarity index 67% rename from src/BlazorAdmin/Services/CatalogItemService/Delete.DeleteCatalogItemResult.cs rename to src/BlazorAdmin/Services/CatalogItemServices/Delete.DeleteCatalogItemResult.cs index 4b66e4eba..84368157c 100644 --- a/src/BlazorAdmin/Services/CatalogItemService/Delete.DeleteCatalogItemResult.cs +++ b/src/BlazorAdmin/Services/CatalogItemServices/Delete.DeleteCatalogItemResult.cs @@ -1,4 +1,4 @@ -namespace BlazorAdmin.Services.CatalogItemService +namespace BlazorAdmin.Services.CatalogItemServices { public class DeleteCatalogItemResult { diff --git a/src/BlazorAdmin/Services/CatalogItemService/Delete.cs b/src/BlazorAdmin/Services/CatalogItemServices/Delete.cs similarity index 94% rename from src/BlazorAdmin/Services/CatalogItemService/Delete.cs rename to src/BlazorAdmin/Services/CatalogItemServices/Delete.cs index ce74c67f5..4b3620450 100644 --- a/src/BlazorAdmin/Services/CatalogItemService/Delete.cs +++ b/src/BlazorAdmin/Services/CatalogItemServices/Delete.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using Newtonsoft.Json; -namespace BlazorAdmin.Services.CatalogItemService +namespace BlazorAdmin.Services.CatalogItemServices { public class Delete { diff --git a/src/BlazorAdmin/Services/CatalogItemService/Edit.EditCatalogItemResult.cs b/src/BlazorAdmin/Services/CatalogItemServices/Edit.EditCatalogItemResult.cs similarity index 70% rename from src/BlazorAdmin/Services/CatalogItemService/Edit.EditCatalogItemResult.cs rename to src/BlazorAdmin/Services/CatalogItemServices/Edit.EditCatalogItemResult.cs index fb17b939e..9f303ebc8 100644 --- a/src/BlazorAdmin/Services/CatalogItemService/Edit.EditCatalogItemResult.cs +++ b/src/BlazorAdmin/Services/CatalogItemServices/Edit.EditCatalogItemResult.cs @@ -1,4 +1,4 @@ -namespace BlazorAdmin.Services.CatalogItemService +namespace BlazorAdmin.Services.CatalogItemServices { public class EditCatalogItemResult { diff --git a/src/BlazorAdmin/Services/CatalogItemService/Edit.cs b/src/BlazorAdmin/Services/CatalogItemServices/Edit.cs similarity index 95% rename from src/BlazorAdmin/Services/CatalogItemService/Edit.cs rename to src/BlazorAdmin/Services/CatalogItemServices/Edit.cs index d80f19c9b..7bf917a53 100644 --- a/src/BlazorAdmin/Services/CatalogItemService/Edit.cs +++ b/src/BlazorAdmin/Services/CatalogItemServices/Edit.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Newtonsoft.Json; -namespace BlazorAdmin.Services.CatalogItemService +namespace BlazorAdmin.Services.CatalogItemServices { public class Edit { diff --git a/src/BlazorAdmin/Services/CatalogItemService/GetById.GetByIdCatalogItemResult.cs b/src/BlazorAdmin/Services/CatalogItemServices/GetById.GetByIdCatalogItemResult.cs similarity index 70% rename from src/BlazorAdmin/Services/CatalogItemService/GetById.GetByIdCatalogItemResult.cs rename to src/BlazorAdmin/Services/CatalogItemServices/GetById.GetByIdCatalogItemResult.cs index 5c9b7a872..e7e9f1ded 100644 --- a/src/BlazorAdmin/Services/CatalogItemService/GetById.GetByIdCatalogItemResult.cs +++ b/src/BlazorAdmin/Services/CatalogItemServices/GetById.GetByIdCatalogItemResult.cs @@ -1,4 +1,4 @@ -namespace BlazorAdmin.Services.CatalogItemService +namespace BlazorAdmin.Services.CatalogItemServices { public class GetByIdCatalogItemResult { diff --git a/src/BlazorAdmin/Services/CatalogItemService/GetById.cs b/src/BlazorAdmin/Services/CatalogItemServices/GetById.cs similarity index 94% rename from src/BlazorAdmin/Services/CatalogItemService/GetById.cs rename to src/BlazorAdmin/Services/CatalogItemServices/GetById.cs index 9539fb71b..aaf70c860 100644 --- a/src/BlazorAdmin/Services/CatalogItemService/GetById.cs +++ b/src/BlazorAdmin/Services/CatalogItemServices/GetById.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using Newtonsoft.Json; -namespace BlazorAdmin.Services.CatalogItemService +namespace BlazorAdmin.Services.CatalogItemServices { public class GetById { diff --git a/src/BlazorAdmin/Services/CatalogItemService/ListPaged.PagedCatalogItemResult.cs b/src/BlazorAdmin/Services/CatalogItemServices/ListPaged.PagedCatalogItemResult.cs similarity index 81% rename from src/BlazorAdmin/Services/CatalogItemService/ListPaged.PagedCatalogItemResult.cs rename to src/BlazorAdmin/Services/CatalogItemServices/ListPaged.PagedCatalogItemResult.cs index e1217c144..531e78ab6 100644 --- a/src/BlazorAdmin/Services/CatalogItemService/ListPaged.PagedCatalogItemResult.cs +++ b/src/BlazorAdmin/Services/CatalogItemServices/ListPaged.PagedCatalogItemResult.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace BlazorAdmin.Services.CatalogItemService +namespace BlazorAdmin.Services.CatalogItemServices { public class PagedCatalogItemResult { diff --git a/src/BlazorAdmin/Services/CatalogItemService/ListPaged.cs b/src/BlazorAdmin/Services/CatalogItemServices/ListPaged.cs similarity index 94% rename from src/BlazorAdmin/Services/CatalogItemService/ListPaged.cs rename to src/BlazorAdmin/Services/CatalogItemServices/ListPaged.cs index 25e63e09a..96631684a 100644 --- a/src/BlazorAdmin/Services/CatalogItemService/ListPaged.cs +++ b/src/BlazorAdmin/Services/CatalogItemServices/ListPaged.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using Newtonsoft.Json; -namespace BlazorAdmin.Services.CatalogItemService +namespace BlazorAdmin.Services.CatalogItemServices { public class ListPaged { diff --git a/src/BlazorAdmin/Services/CatalogTypeService/List.CatalogType.cs b/src/BlazorAdmin/Services/CatalogTypeServices/List.CatalogType.cs similarity index 69% rename from src/BlazorAdmin/Services/CatalogTypeService/List.CatalogType.cs rename to src/BlazorAdmin/Services/CatalogTypeServices/List.CatalogType.cs index 370e9c4be..0a22de36b 100644 --- a/src/BlazorAdmin/Services/CatalogTypeService/List.CatalogType.cs +++ b/src/BlazorAdmin/Services/CatalogTypeServices/List.CatalogType.cs @@ -1,4 +1,4 @@ -namespace BlazorAdmin.Services.CatalogTypeService +namespace BlazorAdmin.Services.CatalogTypeServices { public class CatalogType { diff --git a/src/BlazorAdmin/Services/CatalogTypeService/List.CatalogTypeResult.cs b/src/BlazorAdmin/Services/CatalogTypeServices/List.CatalogTypeResult.cs similarity index 77% rename from src/BlazorAdmin/Services/CatalogTypeService/List.CatalogTypeResult.cs rename to src/BlazorAdmin/Services/CatalogTypeServices/List.CatalogTypeResult.cs index a5c8721d1..a897967d2 100644 --- a/src/BlazorAdmin/Services/CatalogTypeService/List.CatalogTypeResult.cs +++ b/src/BlazorAdmin/Services/CatalogTypeServices/List.CatalogTypeResult.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace BlazorAdmin.Services.CatalogTypeService +namespace BlazorAdmin.Services.CatalogTypeServices { public class CatalogTypeResult { diff --git a/src/BlazorAdmin/Services/CatalogTypeService/List.cs b/src/BlazorAdmin/Services/CatalogTypeServices/List.cs similarity index 96% rename from src/BlazorAdmin/Services/CatalogTypeService/List.cs rename to src/BlazorAdmin/Services/CatalogTypeServices/List.cs index f23b101da..c5ab999ee 100644 --- a/src/BlazorAdmin/Services/CatalogTypeService/List.cs +++ b/src/BlazorAdmin/Services/CatalogTypeServices/List.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Components.WebAssembly.Authentication; using Newtonsoft.Json; -namespace BlazorAdmin.Services.CatalogTypeService +namespace BlazorAdmin.Services.CatalogTypeServices { public class List { diff --git a/src/BlazorAdmin/Shared/MainLayout.razor b/src/BlazorAdmin/Shared/MainLayout.razor index aa393346d..c9438fa26 100644 --- a/src/BlazorAdmin/Shared/MainLayout.razor +++ b/src/BlazorAdmin/Shared/MainLayout.razor @@ -3,7 +3,7 @@ @inherits BlazorAdmin.Helpers.BlazorLayoutComponent - + diff --git a/src/BlazorAdmin/_Imports.razor b/src/BlazorAdmin/_Imports.razor index b45b7ad7a..ecad0156e 100644 --- a/src/BlazorAdmin/_Imports.razor +++ b/src/BlazorAdmin/_Imports.razor @@ -10,8 +10,8 @@ @using BlazorAdmin @using BlazorAdmin.Shared @using BlazorAdmin.Services -@using BlazorAdmin.Services.CatalogBrandService -@using BlazorAdmin.Services.CatalogItemService -@using BlazorAdmin.Services.CatalogTypeService +@using BlazorAdmin.Services.CatalogBrandServices +@using BlazorAdmin.Services.CatalogItemServices +@using BlazorAdmin.Services.CatalogTypeServices @using Microsoft.Extensions.Logging @using BlazorAdmin.JavaScript diff --git a/src/Shared/Authorization/ClaimValue.cs b/src/BlazorShared/Authorization/ClaimValue.cs similarity index 90% rename from src/Shared/Authorization/ClaimValue.cs rename to src/BlazorShared/Authorization/ClaimValue.cs index b1b24c583..f2749cfd2 100644 --- a/src/Shared/Authorization/ClaimValue.cs +++ b/src/BlazorShared/Authorization/ClaimValue.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace Shared.Authorization +namespace BlazorShared.Authorization { public class ClaimValue { diff --git a/src/BlazorShared/Authorization/Constants.cs b/src/BlazorShared/Authorization/Constants.cs new file mode 100644 index 000000000..59dceb666 --- /dev/null +++ b/src/BlazorShared/Authorization/Constants.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BlazorShared.Authorization +{ + public class Constants + { + public static class Roles + { + public const string ADMINISTRATORS = "Administrators"; + } + } +} diff --git a/src/Shared/Authorization/UserInfo.cs b/src/BlazorShared/Authorization/UserInfo.cs similarity index 91% rename from src/Shared/Authorization/UserInfo.cs rename to src/BlazorShared/Authorization/UserInfo.cs index 9c4e2ccca..d5ea56a87 100644 --- a/src/Shared/Authorization/UserInfo.cs +++ b/src/BlazorShared/Authorization/UserInfo.cs @@ -3,7 +3,7 @@ using System.Security.Claims; using System.Text; -namespace Shared.Authorization +namespace BlazorShared.Authorization { public class UserInfo { diff --git a/src/BlazorShared/BlazorShared.csproj b/src/BlazorShared/BlazorShared.csproj new file mode 100644 index 000000000..07b614bac --- /dev/null +++ b/src/BlazorShared/BlazorShared.csproj @@ -0,0 +1,9 @@ + + + + netstandard2.0 + BlazorShared + BlazorShared + + + diff --git a/src/Infrastructure/Identity/AppIdentityDbContextSeed.cs b/src/Infrastructure/Identity/AppIdentityDbContextSeed.cs index 3664fe14f..e30edcd00 100644 --- a/src/Infrastructure/Identity/AppIdentityDbContextSeed.cs +++ b/src/Infrastructure/Identity/AppIdentityDbContextSeed.cs @@ -8,7 +8,7 @@ public class AppIdentityDbContextSeed { public static async Task SeedAsync(UserManager userManager, RoleManager roleManager) { - await roleManager.CreateAsync(new IdentityRole(AuthorizationConstants.Roles.ADMINISTRATORS)); + await roleManager.CreateAsync(new IdentityRole(BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS)); var defaultUser = new ApplicationUser { UserName = "demouser@microsoft.com", Email = "demouser@microsoft.com" }; await userManager.CreateAsync(defaultUser, AuthorizationConstants.DEFAULT_PASSWORD); @@ -17,7 +17,7 @@ public static async Task SeedAsync(UserManager userManager, Rol var adminUser = new ApplicationUser { UserName = adminUserName, Email = adminUserName }; await userManager.CreateAsync(adminUser, AuthorizationConstants.DEFAULT_PASSWORD); adminUser = await userManager.FindByNameAsync(adminUserName); - await userManager.AddToRoleAsync(adminUser, AuthorizationConstants.Roles.ADMINISTRATORS); + await userManager.AddToRoleAsync(adminUser, BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS); } } } diff --git a/src/PublicApi/CatalogItemEndpoints/Create.cs b/src/PublicApi/CatalogItemEndpoints/Create.cs index e3c31d8d0..c2e828bf0 100644 --- a/src/PublicApi/CatalogItemEndpoints/Create.cs +++ b/src/PublicApi/CatalogItemEndpoints/Create.cs @@ -11,7 +11,7 @@ namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints { - [Authorize(Roles = AuthorizationConstants.Roles.ADMINISTRATORS, AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] + [Authorize(Roles = BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS, AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] public class Create : BaseAsyncEndpoint { private readonly IAsyncRepository _itemRepository; diff --git a/src/PublicApi/CatalogItemEndpoints/Delete.cs b/src/PublicApi/CatalogItemEndpoints/Delete.cs index ed3c7120a..010e06ab1 100644 --- a/src/PublicApi/CatalogItemEndpoints/Delete.cs +++ b/src/PublicApi/CatalogItemEndpoints/Delete.cs @@ -10,7 +10,7 @@ namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints { - [Authorize(Roles = AuthorizationConstants.Roles.ADMINISTRATORS, AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] + [Authorize(Roles = BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS, AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] public class Delete : BaseAsyncEndpoint { private readonly IAsyncRepository _itemRepository; diff --git a/src/PublicApi/CatalogItemEndpoints/Update.cs b/src/PublicApi/CatalogItemEndpoints/Update.cs index fe8cd9643..8c97e065c 100644 --- a/src/PublicApi/CatalogItemEndpoints/Update.cs +++ b/src/PublicApi/CatalogItemEndpoints/Update.cs @@ -12,7 +12,7 @@ namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints { - [Authorize(Roles = AuthorizationConstants.Roles.ADMINISTRATORS, AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] + [Authorize(Roles = BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS, AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] public class Update : BaseAsyncEndpoint { private readonly IAsyncRepository _itemRepository; diff --git a/src/Shared/Shared.csproj b/src/Shared/Shared.csproj deleted file mode 100644 index 9f5c4f4ab..000000000 --- a/src/Shared/Shared.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - netstandard2.0 - - - diff --git a/src/Web/Controllers/UserController.cs b/src/Web/Controllers/UserController.cs index 7c11ebc22..eedce159b 100644 --- a/src/Web/Controllers/UserController.cs +++ b/src/Web/Controllers/UserController.cs @@ -3,7 +3,7 @@ using System.Security.Claims; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Shared.Authorization; +using BlazorShared.Authorization; namespace Microsoft.eShopWeb.Web.Controllers { diff --git a/src/Web/Pages/Admin/EditCatalogItem.cshtml.cs b/src/Web/Pages/Admin/EditCatalogItem.cshtml.cs index 6e1a7fe8d..686114db9 100644 --- a/src/Web/Pages/Admin/EditCatalogItem.cshtml.cs +++ b/src/Web/Pages/Admin/EditCatalogItem.cshtml.cs @@ -8,7 +8,7 @@ namespace Microsoft.eShopWeb.Web.Pages.Admin { - [Authorize(Roles = AuthorizationConstants.Roles.ADMINISTRATORS)] + [Authorize(Roles = BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS)] public class EditCatalogItemModel : PageModel { private readonly ICatalogItemViewModelService _catalogItemViewModelService; diff --git a/src/Web/Pages/Admin/Index.cshtml.cs b/src/Web/Pages/Admin/Index.cshtml.cs index 4328bb875..52a961763 100644 --- a/src/Web/Pages/Admin/Index.cshtml.cs +++ b/src/Web/Pages/Admin/Index.cshtml.cs @@ -9,7 +9,7 @@ namespace Microsoft.eShopWeb.Web.Pages.Admin { - [Authorize(Roles = AuthorizationConstants.Roles.ADMINISTRATORS)] + [Authorize(Roles = BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS)] public class IndexModel : PageModel { public IndexModel() diff --git a/src/Web/Web.csproj b/src/Web/Web.csproj index 76547c37e..74ea66bcc 100644 --- a/src/Web/Web.csproj +++ b/src/Web/Web.csproj @@ -51,8 +51,8 @@ + -