BlazorShared and Services (#430)
* Service to Services * Change Shared project to BlazorShared * change refrerances to BlazorShared
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
||||
<ProjectReference Include="..\BlazorShared\BlazorShared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Components.Authorization;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Shared.Authorization;
|
||||
using BlazorShared.Authorization;
|
||||
|
||||
namespace BlazorAdmin
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Services.CatalogBrandService.List.GetBrandName(Brands, _item.CatalogBrandId)
|
||||
@Services.CatalogBrandServices.List.GetBrandName(Brands, _item.CatalogBrandId)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@@ -55,7 +55,7 @@
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Services.CatalogTypeService.List.GetTypeName(Types, _item.CatalogTypeId)
|
||||
@Services.CatalogTypeServices.List.GetTypeName(Types, _item.CatalogTypeId)
|
||||
</dd>
|
||||
<dt>
|
||||
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();
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Services.CatalogBrandService.List.GetBrandName(Brands, _item.CatalogBrandId)
|
||||
@Services.CatalogBrandServices.List.GetBrandName(Brands, _item.CatalogBrandId)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@@ -58,7 +58,7 @@
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Services.CatalogTypeService.List.GetTypeName(Types, _item.CatalogTypeId)
|
||||
@Services.CatalogTypeServices.List.GetTypeName(Types, _item.CatalogTypeId)
|
||||
</dd>
|
||||
<dt>
|
||||
Price
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
<td>
|
||||
<img class="img-thumbnail" src="@($"https://localhost:44315/{item.PictureUri}")">
|
||||
</td>
|
||||
<td>@Services.CatalogTypeService.List.GetTypeName(catalogTypes, item.CatalogTypeId)</td>
|
||||
<td>@Services.CatalogBrandService.List.GetBrandName(catalogBrands, item.CatalogBrandId)</td>
|
||||
<td>@Services.CatalogTypeServices.List.GetTypeName(catalogTypes, item.CatalogTypeId)</td>
|
||||
<td>@Services.CatalogBrandServices.List.GetBrandName(catalogBrands, item.CatalogBrandId)</td>
|
||||
<td>@item.Id</td>
|
||||
<td>@item.Name</td>
|
||||
<td>@item.Description</td>
|
||||
|
||||
@@ -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 @@ namespace BlazorAdmin.Pages.CatalogItemPage
|
||||
{
|
||||
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 @@ namespace BlazorAdmin.Pages.CatalogItemPage
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ using BlazorAdmin.JavaScript;
|
||||
using Blazored.LocalStorage;
|
||||
using Microsoft.JSInterop;
|
||||
using Newtonsoft.Json;
|
||||
using Shared.Authorization;
|
||||
using BlazorShared.Authorization;
|
||||
|
||||
namespace BlazorAdmin.Services
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BlazorAdmin.Services.CatalogBrandService
|
||||
namespace BlazorAdmin.Services.CatalogBrandServices
|
||||
{
|
||||
public class CatalogBrand
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogBrandService
|
||||
namespace BlazorAdmin.Services.CatalogBrandServices
|
||||
{
|
||||
public class CatalogBrandResult
|
||||
{
|
||||
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogBrandService
|
||||
namespace BlazorAdmin.Services.CatalogBrandServices
|
||||
{
|
||||
public class List
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogItemService
|
||||
namespace BlazorAdmin.Services.CatalogItemServices
|
||||
{
|
||||
public class CatalogItem
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogItemService
|
||||
namespace BlazorAdmin.Services.CatalogItemServices
|
||||
{
|
||||
public class CreateCatalogItemRequest
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogItemService
|
||||
namespace BlazorAdmin.Services.CatalogItemServices
|
||||
{
|
||||
public class CreateCatalogItemResult
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogItemService
|
||||
namespace BlazorAdmin.Services.CatalogItemServices
|
||||
{
|
||||
public class Create
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BlazorAdmin.Services.CatalogItemService
|
||||
namespace BlazorAdmin.Services.CatalogItemServices
|
||||
{
|
||||
public class DeleteCatalogItemResult
|
||||
{
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogItemService
|
||||
namespace BlazorAdmin.Services.CatalogItemServices
|
||||
{
|
||||
public class Delete
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BlazorAdmin.Services.CatalogItemService
|
||||
namespace BlazorAdmin.Services.CatalogItemServices
|
||||
{
|
||||
public class EditCatalogItemResult
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogItemService
|
||||
namespace BlazorAdmin.Services.CatalogItemServices
|
||||
{
|
||||
public class Edit
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BlazorAdmin.Services.CatalogItemService
|
||||
namespace BlazorAdmin.Services.CatalogItemServices
|
||||
{
|
||||
public class GetByIdCatalogItemResult
|
||||
{
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogItemService
|
||||
namespace BlazorAdmin.Services.CatalogItemServices
|
||||
{
|
||||
public class GetById
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogItemService
|
||||
namespace BlazorAdmin.Services.CatalogItemServices
|
||||
{
|
||||
public class PagedCatalogItemResult
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogItemService
|
||||
namespace BlazorAdmin.Services.CatalogItemServices
|
||||
{
|
||||
public class ListPaged
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BlazorAdmin.Services.CatalogTypeService
|
||||
namespace BlazorAdmin.Services.CatalogTypeServices
|
||||
{
|
||||
public class CatalogType
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogTypeService
|
||||
namespace BlazorAdmin.Services.CatalogTypeServices
|
||||
{
|
||||
public class CatalogTypeResult
|
||||
{
|
||||
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BlazorAdmin.Services.CatalogTypeService
|
||||
namespace BlazorAdmin.Services.CatalogTypeServices
|
||||
{
|
||||
public class List
|
||||
{
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
@inherits BlazorAdmin.Helpers.BlazorLayoutComponent
|
||||
|
||||
<AuthorizeView Roles=@Constants.Roles.ADMINISTRATORS>
|
||||
<AuthorizeView Roles=@BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS>
|
||||
<div class="sidebar">
|
||||
<NavMenu />
|
||||
</div>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user