BlazorShared and Services (#430)
* Service to Services * Change Shared project to BlazorShared * change refrerances to BlazorShared
This commit is contained in:
@@ -34,7 +34,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublicApi", "src\PublicApi\
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorAdmin", "src\BlazorAdmin\BlazorAdmin.csproj", "{71368733-80A4-4869-B215-3A7001878577}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorAdmin", "src\BlazorAdmin\BlazorAdmin.csproj", "{71368733-80A4-4869-B215-3A7001878577}"
|
||||||
EndProject
|
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
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{71368733-80A4-4869-B215-3A7001878577}.Release|Any CPU.Build.0 = 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
|
{715CF7AF-A1EE-40A6-94A0-8DA3F3B2CAE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{7BDB419E-FAC1-4D43-8AA9-FB61EBE31BB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{715CF7AF-A1EE-40A6-94A0-8DA3F3B2CAE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{7BDB419E-FAC1-4D43-8AA9-FB61EBE31BB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{715CF7AF-A1EE-40A6-94A0-8DA3F3B2CAE9}.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}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -95,7 +95,7 @@ Global
|
|||||||
{7EFB5482-F942-4C3D-94B0-9B70596E6D0A} = {15EA4737-125B-4E6E-A806-E13B7EBCDCCF}
|
{7EFB5482-F942-4C3D-94B0-9B70596E6D0A} = {15EA4737-125B-4E6E-A806-E13B7EBCDCCF}
|
||||||
{B5E4F33C-4667-4A55-AF6A-740F84C4CF3A} = {419A6ACE-0419-4315-A6FB-B0E63D39432E}
|
{B5E4F33C-4667-4A55-AF6A-740F84C4CF3A} = {419A6ACE-0419-4315-A6FB-B0E63D39432E}
|
||||||
{71368733-80A4-4869-B215-3A7001878577} = {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
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {49813262-5DA3-4D61-ABD3-493C74CE8C2B}
|
SolutionGuid = {49813262-5DA3-4D61-ABD3-493C74CE8C2B}
|
||||||
|
|||||||
@@ -13,4 +13,8 @@
|
|||||||
<PackageReference Include="System.Text.Json" Version="4.7.2" />
|
<PackageReference Include="System.Text.Json" Version="4.7.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\BlazorShared\BlazorShared.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -2,10 +2,6 @@
|
|||||||
{
|
{
|
||||||
public class AuthorizationConstants
|
public class AuthorizationConstants
|
||||||
{
|
{
|
||||||
public static class Roles
|
|
||||||
{
|
|
||||||
public const string ADMINISTRATORS = "Administrators";
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Don't use this in production
|
// TODO: Don't use this in production
|
||||||
public const string DEFAULT_PASSWORD = "Pass@word1";
|
public const string DEFAULT_PASSWORD = "Pass@word1";
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
<ProjectReference Include="..\BlazorShared\BlazorShared.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -3,10 +3,5 @@
|
|||||||
public class Constants
|
public class Constants
|
||||||
{
|
{
|
||||||
public const string API_URL = "https://localhost:5099/api/";
|
public const string API_URL = "https://localhost:5099/api/";
|
||||||
|
|
||||||
public static class Roles
|
|
||||||
{
|
|
||||||
public const string ADMINISTRATORS = "Administrators";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Components.Authorization;
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Shared.Authorization;
|
using BlazorShared.Authorization;
|
||||||
|
|
||||||
namespace BlazorAdmin
|
namespace BlazorAdmin
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
|
|
||||||
private async Task CreateClick()
|
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);
|
await OnCloseClick.InvokeAsync(null);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
<dd>
|
<dd>
|
||||||
@Services.CatalogBrandService.List.GetBrandName(Brands, _item.CatalogBrandId)
|
@Services.CatalogBrandServices.List.GetBrandName(Brands, _item.CatalogBrandId)
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt>
|
<dt>
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
<dd>
|
<dd>
|
||||||
@Services.CatalogTypeService.List.GetTypeName(Types, _item.CatalogTypeId)
|
@Services.CatalogTypeServices.List.GetTypeName(Types, _item.CatalogTypeId)
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
Price
|
Price
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
{
|
{
|
||||||
// TODO: Add some kind of "are you sure" check before this
|
// 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);
|
await OnCloseClick.InvokeAsync(null);
|
||||||
Close();
|
Close();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
<dd>
|
<dd>
|
||||||
@Services.CatalogBrandService.List.GetBrandName(Brands, _item.CatalogBrandId)
|
@Services.CatalogBrandServices.List.GetBrandName(Brands, _item.CatalogBrandId)
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt>
|
<dt>
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
<dd>
|
<dd>
|
||||||
@Services.CatalogTypeService.List.GetTypeName(Types, _item.CatalogTypeId)
|
@Services.CatalogTypeServices.List.GetTypeName(Types, _item.CatalogTypeId)
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
Price
|
Price
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
|
|
||||||
private async Task SaveClick()
|
private async Task SaveClick()
|
||||||
{
|
{
|
||||||
await new BlazorAdmin.Services.CatalogItemService.Edit(Auth).HandleAsync(_item);
|
await new BlazorAdmin.Services.CatalogItemServices.Edit(Auth).HandleAsync(_item);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@page "/admin"
|
@page "/admin"
|
||||||
@attribute [Authorize(Roles = Constants.Roles.ADMINISTRATORS)]
|
@attribute [Authorize(Roles = BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS)]
|
||||||
@inject AuthService Auth
|
@inject AuthService Auth
|
||||||
@using global::Shared.Authorization
|
@using global::BlazorShared.Authorization
|
||||||
@inherits BlazorAdmin.Helpers.BlazorComponent
|
@inherits BlazorAdmin.Helpers.BlazorComponent
|
||||||
@namespace BlazorAdmin.Pages.CatalogItemPage
|
@namespace BlazorAdmin.Pages.CatalogItemPage
|
||||||
|
|
||||||
@@ -40,8 +40,8 @@ else
|
|||||||
<td>
|
<td>
|
||||||
<img class="img-thumbnail" src="@($"https://localhost:44315/{item.PictureUri}")">
|
<img class="img-thumbnail" src="@($"https://localhost:44315/{item.PictureUri}")">
|
||||||
</td>
|
</td>
|
||||||
<td>@Services.CatalogTypeService.List.GetTypeName(catalogTypes, item.CatalogTypeId)</td>
|
<td>@Services.CatalogTypeServices.List.GetTypeName(catalogTypes, item.CatalogTypeId)</td>
|
||||||
<td>@Services.CatalogBrandService.List.GetBrandName(catalogBrands, item.CatalogBrandId)</td>
|
<td>@Services.CatalogBrandServices.List.GetBrandName(catalogBrands, item.CatalogBrandId)</td>
|
||||||
<td>@item.Id</td>
|
<td>@item.Id</td>
|
||||||
<td>@item.Name</td>
|
<td>@item.Name</td>
|
||||||
<td>@item.Description</td>
|
<td>@item.Description</td>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using BlazorAdmin.Helpers;
|
using BlazorAdmin.Helpers;
|
||||||
using BlazorAdmin.Services.CatalogBrandService;
|
using BlazorAdmin.Services.CatalogBrandServices;
|
||||||
using BlazorAdmin.Services.CatalogItemService;
|
using BlazorAdmin.Services.CatalogItemServices;
|
||||||
using BlazorAdmin.Services.CatalogTypeService;
|
using BlazorAdmin.Services.CatalogTypeServices;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -22,9 +22,9 @@ namespace BlazorAdmin.Pages.CatalogItemPage
|
|||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
catalogItems = await new BlazorAdmin.Services.CatalogItemService.ListPaged(Auth).HandleAsync(50);
|
catalogItems = await new BlazorAdmin.Services.CatalogItemServices.ListPaged(Auth).HandleAsync(50);
|
||||||
catalogTypes = await new BlazorAdmin.Services.CatalogTypeService.List(Auth).HandleAsync();
|
catalogTypes = await new BlazorAdmin.Services.CatalogTypeServices.List(Auth).HandleAsync();
|
||||||
catalogBrands = await new BlazorAdmin.Services.CatalogBrandService.List(Auth).HandleAsync();
|
catalogBrands = await new BlazorAdmin.Services.CatalogBrandServices.List(Auth).HandleAsync();
|
||||||
|
|
||||||
CallRequestRefresh();
|
CallRequestRefresh();
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ namespace BlazorAdmin.Pages.CatalogItemPage
|
|||||||
|
|
||||||
private async Task ReloadCatalogItems()
|
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();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using BlazorAdmin.JavaScript;
|
|||||||
using Blazored.LocalStorage;
|
using Blazored.LocalStorage;
|
||||||
using Microsoft.JSInterop;
|
using Microsoft.JSInterop;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Shared.Authorization;
|
using BlazorShared.Authorization;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services
|
namespace BlazorAdmin.Services
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace BlazorAdmin.Services.CatalogBrandService
|
namespace BlazorAdmin.Services.CatalogBrandServices
|
||||||
{
|
{
|
||||||
public class CatalogBrand
|
public class CatalogBrand
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogBrandService
|
namespace BlazorAdmin.Services.CatalogBrandServices
|
||||||
{
|
{
|
||||||
public class CatalogBrandResult
|
public class CatalogBrandResult
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
|
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogBrandService
|
namespace BlazorAdmin.Services.CatalogBrandServices
|
||||||
{
|
{
|
||||||
public class List
|
public class List
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogItemService
|
namespace BlazorAdmin.Services.CatalogItemServices
|
||||||
{
|
{
|
||||||
public class CatalogItem
|
public class CatalogItem
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogItemService
|
namespace BlazorAdmin.Services.CatalogItemServices
|
||||||
{
|
{
|
||||||
public class CreateCatalogItemRequest
|
public class CreateCatalogItemRequest
|
||||||
{
|
{
|
||||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogItemService
|
namespace BlazorAdmin.Services.CatalogItemServices
|
||||||
{
|
{
|
||||||
public class CreateCatalogItemResult
|
public class CreateCatalogItemResult
|
||||||
{
|
{
|
||||||
@@ -4,7 +4,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogItemService
|
namespace BlazorAdmin.Services.CatalogItemServices
|
||||||
{
|
{
|
||||||
public class Create
|
public class Create
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace BlazorAdmin.Services.CatalogItemService
|
namespace BlazorAdmin.Services.CatalogItemServices
|
||||||
{
|
{
|
||||||
public class DeleteCatalogItemResult
|
public class DeleteCatalogItemResult
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogItemService
|
namespace BlazorAdmin.Services.CatalogItemServices
|
||||||
{
|
{
|
||||||
public class Delete
|
public class Delete
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace BlazorAdmin.Services.CatalogItemService
|
namespace BlazorAdmin.Services.CatalogItemServices
|
||||||
{
|
{
|
||||||
public class EditCatalogItemResult
|
public class EditCatalogItemResult
|
||||||
{
|
{
|
||||||
@@ -4,7 +4,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogItemService
|
namespace BlazorAdmin.Services.CatalogItemServices
|
||||||
{
|
{
|
||||||
public class Edit
|
public class Edit
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace BlazorAdmin.Services.CatalogItemService
|
namespace BlazorAdmin.Services.CatalogItemServices
|
||||||
{
|
{
|
||||||
public class GetByIdCatalogItemResult
|
public class GetByIdCatalogItemResult
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogItemService
|
namespace BlazorAdmin.Services.CatalogItemServices
|
||||||
{
|
{
|
||||||
public class GetById
|
public class GetById
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogItemService
|
namespace BlazorAdmin.Services.CatalogItemServices
|
||||||
{
|
{
|
||||||
public class PagedCatalogItemResult
|
public class PagedCatalogItemResult
|
||||||
{
|
{
|
||||||
@@ -3,7 +3,7 @@ using System.Net;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogItemService
|
namespace BlazorAdmin.Services.CatalogItemServices
|
||||||
{
|
{
|
||||||
public class ListPaged
|
public class ListPaged
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace BlazorAdmin.Services.CatalogTypeService
|
namespace BlazorAdmin.Services.CatalogTypeServices
|
||||||
{
|
{
|
||||||
public class CatalogType
|
public class CatalogType
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogTypeService
|
namespace BlazorAdmin.Services.CatalogTypeServices
|
||||||
{
|
{
|
||||||
public class CatalogTypeResult
|
public class CatalogTypeResult
|
||||||
{
|
{
|
||||||
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
|
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BlazorAdmin.Services.CatalogTypeService
|
namespace BlazorAdmin.Services.CatalogTypeServices
|
||||||
{
|
{
|
||||||
public class List
|
public class List
|
||||||
{
|
{
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
@inherits BlazorAdmin.Helpers.BlazorLayoutComponent
|
@inherits BlazorAdmin.Helpers.BlazorLayoutComponent
|
||||||
|
|
||||||
<AuthorizeView Roles=@Constants.Roles.ADMINISTRATORS>
|
<AuthorizeView Roles=@BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS>
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<NavMenu />
|
<NavMenu />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
@using BlazorAdmin
|
@using BlazorAdmin
|
||||||
@using BlazorAdmin.Shared
|
@using BlazorAdmin.Shared
|
||||||
@using BlazorAdmin.Services
|
@using BlazorAdmin.Services
|
||||||
@using BlazorAdmin.Services.CatalogBrandService
|
@using BlazorAdmin.Services.CatalogBrandServices
|
||||||
@using BlazorAdmin.Services.CatalogItemService
|
@using BlazorAdmin.Services.CatalogItemServices
|
||||||
@using BlazorAdmin.Services.CatalogTypeService
|
@using BlazorAdmin.Services.CatalogTypeServices
|
||||||
@using Microsoft.Extensions.Logging
|
@using Microsoft.Extensions.Logging
|
||||||
@using BlazorAdmin.JavaScript
|
@using BlazorAdmin.JavaScript
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Shared.Authorization
|
namespace BlazorShared.Authorization
|
||||||
{
|
{
|
||||||
public class ClaimValue
|
public class ClaimValue
|
||||||
{
|
{
|
||||||
14
src/BlazorShared/Authorization/Constants.cs
Normal file
14
src/BlazorShared/Authorization/Constants.cs
Normal file
@@ -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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Shared.Authorization
|
namespace BlazorShared.Authorization
|
||||||
{
|
{
|
||||||
public class UserInfo
|
public class UserInfo
|
||||||
{
|
{
|
||||||
9
src/BlazorShared/BlazorShared.csproj
Normal file
9
src/BlazorShared/BlazorShared.csproj
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
<RootNamespace>BlazorShared</RootNamespace>
|
||||||
|
<AssemblyName>BlazorShared</AssemblyName>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -8,7 +8,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity
|
|||||||
{
|
{
|
||||||
public static async Task SeedAsync(UserManager<ApplicationUser> userManager, RoleManager<IdentityRole> roleManager)
|
public static async Task SeedAsync(UserManager<ApplicationUser> userManager, RoleManager<IdentityRole> 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" };
|
var defaultUser = new ApplicationUser { UserName = "demouser@microsoft.com", Email = "demouser@microsoft.com" };
|
||||||
await userManager.CreateAsync(defaultUser, AuthorizationConstants.DEFAULT_PASSWORD);
|
await userManager.CreateAsync(defaultUser, AuthorizationConstants.DEFAULT_PASSWORD);
|
||||||
@@ -17,7 +17,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity
|
|||||||
var adminUser = new ApplicationUser { UserName = adminUserName, Email = adminUserName };
|
var adminUser = new ApplicationUser { UserName = adminUserName, Email = adminUserName };
|
||||||
await userManager.CreateAsync(adminUser, AuthorizationConstants.DEFAULT_PASSWORD);
|
await userManager.CreateAsync(adminUser, AuthorizationConstants.DEFAULT_PASSWORD);
|
||||||
adminUser = await userManager.FindByNameAsync(adminUserName);
|
adminUser = await userManager.FindByNameAsync(adminUserName);
|
||||||
await userManager.AddToRoleAsync(adminUser, AuthorizationConstants.Roles.ADMINISTRATORS);
|
await userManager.AddToRoleAsync(adminUser, BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using System.Threading.Tasks;
|
|||||||
namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints
|
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<CreateCatalogItemRequest, CreateCatalogItemResponse>
|
public class Create : BaseAsyncEndpoint<CreateCatalogItemRequest, CreateCatalogItemResponse>
|
||||||
{
|
{
|
||||||
private readonly IAsyncRepository<CatalogItem> _itemRepository;
|
private readonly IAsyncRepository<CatalogItem> _itemRepository;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints
|
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<DeleteCatalogItemRequest, DeleteCatalogItemResponse>
|
public class Delete : BaseAsyncEndpoint<DeleteCatalogItemRequest, DeleteCatalogItemResponse>
|
||||||
{
|
{
|
||||||
private readonly IAsyncRepository<CatalogItem> _itemRepository;
|
private readonly IAsyncRepository<CatalogItem> _itemRepository;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints
|
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<UpdateCatalogItemRequest, UpdateCatalogItemResponse>
|
public class Update : BaseAsyncEndpoint<UpdateCatalogItemRequest, UpdateCatalogItemResponse>
|
||||||
{
|
{
|
||||||
private readonly IAsyncRepository<CatalogItem> _itemRepository;
|
private readonly IAsyncRepository<CatalogItem> _itemRepository;
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -3,7 +3,7 @@ using System.Linq;
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Shared.Authorization;
|
using BlazorShared.Authorization;
|
||||||
|
|
||||||
namespace Microsoft.eShopWeb.Web.Controllers
|
namespace Microsoft.eShopWeb.Web.Controllers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Microsoft.eShopWeb.Web.Pages.Admin
|
namespace Microsoft.eShopWeb.Web.Pages.Admin
|
||||||
{
|
{
|
||||||
[Authorize(Roles = AuthorizationConstants.Roles.ADMINISTRATORS)]
|
[Authorize(Roles = BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS)]
|
||||||
public class EditCatalogItemModel : PageModel
|
public class EditCatalogItemModel : PageModel
|
||||||
{
|
{
|
||||||
private readonly ICatalogItemViewModelService _catalogItemViewModelService;
|
private readonly ICatalogItemViewModelService _catalogItemViewModelService;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Microsoft.eShopWeb.Web.Pages.Admin
|
namespace Microsoft.eShopWeb.Web.Pages.Admin
|
||||||
{
|
{
|
||||||
[Authorize(Roles = AuthorizationConstants.Roles.ADMINISTRATORS)]
|
[Authorize(Roles = BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS)]
|
||||||
public class IndexModel : PageModel
|
public class IndexModel : PageModel
|
||||||
{
|
{
|
||||||
public IndexModel()
|
public IndexModel()
|
||||||
|
|||||||
@@ -51,8 +51,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\ApplicationCore\ApplicationCore.csproj" />
|
<ProjectReference Include="..\ApplicationCore\ApplicationCore.csproj" />
|
||||||
<ProjectReference Include="..\BlazorAdmin\BlazorAdmin.csproj" />
|
<ProjectReference Include="..\BlazorAdmin\BlazorAdmin.csproj" />
|
||||||
|
<ProjectReference Include="..\BlazorShared\BlazorShared.csproj" />
|
||||||
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
|
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
|
||||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="compilerconfig.json" />
|
<None Include="compilerconfig.json" />
|
||||||
|
|||||||
Reference in New Issue
Block a user