mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Audit all changes made in the admin view.
This commit is contained in:
@@ -23,8 +23,11 @@
|
|||||||
// Copyright © 2003-2020 Natalia Portillo
|
// Copyright © 2003-2020 Natalia Portillo
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
namespace Marechai.Database.Models
|
namespace Marechai.Database.Models
|
||||||
@@ -92,8 +95,7 @@ namespace Marechai.Database.Models
|
|||||||
public virtual DbSet<SoundSynth> SoundSynths { get; set; }
|
public virtual DbSet<SoundSynth> SoundSynths { get; set; }
|
||||||
public virtual DbSet<StorageByMachine> StorageByMachine { get; set; }
|
public virtual DbSet<StorageByMachine> StorageByMachine { get; set; }
|
||||||
public virtual DbSet<StorageByOwnedMachine> StorageByOwnedMachine { get; set; }
|
public virtual DbSet<StorageByOwnedMachine> StorageByOwnedMachine { get; set; }
|
||||||
|
public virtual DbSet<Audit> Audit { get; set; }
|
||||||
public virtual DbSet<Audit> Audit { get; set; }
|
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
@@ -105,6 +107,85 @@ namespace Marechai.Database.Models
|
|||||||
optionsBuilder.UseMySql(configuration.GetConnectionString("DefaultConnection")).UseLazyLoadingProxies();
|
optionsBuilder.UseMySql(configuration.GetConnectionString("DefaultConnection")).UseLazyLoadingProxies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<int> SaveChangesWithUserAsync(string userId)
|
||||||
|
{
|
||||||
|
ChangeTracker.DetectChanges();
|
||||||
|
List<Audit> audits = new List<Audit>();
|
||||||
|
|
||||||
|
foreach(EntityEntry entry in ChangeTracker.Entries())
|
||||||
|
{
|
||||||
|
if(entry.Entity is Audit ||
|
||||||
|
entry.State == EntityState.Detached ||
|
||||||
|
entry.State == EntityState.Unchanged)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var audit = new Audit();
|
||||||
|
audit.UserId = userId;
|
||||||
|
audit.Table = entry.Metadata.GetTableName();
|
||||||
|
|
||||||
|
Dictionary<string, object> keys = new Dictionary<string, object>();
|
||||||
|
Dictionary<string, object> olds = new Dictionary<string, object>();
|
||||||
|
Dictionary<string, object> news = new Dictionary<string, object>();
|
||||||
|
List<string> columns = new List<string>();
|
||||||
|
|
||||||
|
foreach(PropertyEntry property in entry.Properties)
|
||||||
|
{
|
||||||
|
string propertyName = property.Metadata.Name;
|
||||||
|
string columnName = property.Metadata.GetColumnName();
|
||||||
|
|
||||||
|
if(property.Metadata.IsPrimaryKey())
|
||||||
|
{
|
||||||
|
keys[propertyName] = property.CurrentValue;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(entry.State)
|
||||||
|
{
|
||||||
|
case EntityState.Deleted:
|
||||||
|
audit.Type = AuditType.Deleted;
|
||||||
|
olds[propertyName] = property.CurrentValue;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case EntityState.Modified:
|
||||||
|
if(property.IsModified)
|
||||||
|
{
|
||||||
|
audit.Type = AuditType.Updated;
|
||||||
|
news[propertyName] = property.CurrentValue;
|
||||||
|
olds[propertyName] = property.OriginalValue;
|
||||||
|
columns.Add(columnName);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EntityState.Added:
|
||||||
|
audit.Type = AuditType.Created;
|
||||||
|
news[propertyName] = property.CurrentValue;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(keys.Count > 0)
|
||||||
|
audit.Keys = keys;
|
||||||
|
|
||||||
|
if(olds.Count > 0)
|
||||||
|
audit.OldValues = olds;
|
||||||
|
|
||||||
|
if(news.Count > 0)
|
||||||
|
audit.NewValues = news;
|
||||||
|
|
||||||
|
if(columns.Count > 0)
|
||||||
|
audit.AffectedColumns = columns;
|
||||||
|
|
||||||
|
audits.Add(audit);
|
||||||
|
}
|
||||||
|
|
||||||
|
await Audit.AddRangeAsync(audits);
|
||||||
|
|
||||||
|
return await SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
@@ -1468,7 +1549,6 @@ namespace Marechai.Database.Models
|
|||||||
|
|
||||||
modelBuilder.Entity<Audit>(entity =>
|
modelBuilder.Entity<Audit>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasIndex(d => d.UserId);
|
|
||||||
entity.HasIndex(d => d.Table);
|
entity.HasIndex(d => d.Table);
|
||||||
entity.HasIndex(d => d.Type);
|
entity.HasIndex(d => d.Type);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<Version>4.0.0.1586</Version>
|
<Version>4.0.0.1608</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
|
|||||||
@@ -26,9 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/companies"
|
@page "/admin/companies"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<CompaniesService>
|
@inherits OwningComponentBase<CompaniesService>
|
||||||
@inject IStringLocalizer<CompaniesService> L
|
@inject IStringLocalizer<CompaniesService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Companies"]</h3>
|
<h3>@L["Companies"]</h3>
|
||||||
@if (_companies is null)
|
@if (_companies is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -56,11 +57,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_companies = null;
|
_companies = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_currentCompany.Id);
|
await Service.DeleteAsync(_currentCompany.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_companies = await Service.GetAsync();
|
_companies = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
@page "/admin/companies/edit/{Id:int}"
|
@page "/admin/companies/edit/{Id:int}"
|
||||||
@page "/admin/companies/create"
|
@page "/admin/companies/create"
|
||||||
@using Marechai.Database
|
@using Marechai.Database
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<CompaniesService>
|
@inherits OwningComponentBase<CompaniesService>
|
||||||
@inject IStringLocalizer<CompaniesService> L
|
@inject IStringLocalizer<CompaniesService> L
|
||||||
@inject Iso31661NumericService CountriesService
|
@inject Iso31661NumericService CountriesService
|
||||||
@@ -37,6 +38,8 @@
|
|||||||
@inject IWebHostEnvironment Host
|
@inject IWebHostEnvironment Host
|
||||||
@inject IFileReaderService FileReaderService;
|
@inject IFileReaderService FileReaderService;
|
||||||
@inject IJSRuntime JSRuntime
|
@inject IJSRuntime JSRuntime
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ using Marechai.Shared;
|
|||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
using Markdig;
|
using Markdig;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
using Microsoft.JSInterop;
|
using Microsoft.JSInterop;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
using Svg.Skia;
|
using Svg.Skia;
|
||||||
@@ -48,6 +49,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
{
|
{
|
||||||
const int _maxUploadSize = 5 * 1048576;
|
const int _maxUploadSize = 5 * 1048576;
|
||||||
bool _addingDescription;
|
bool _addingDescription;
|
||||||
|
AuthenticationState _authState;
|
||||||
List<CompanyViewModel> _companies;
|
List<CompanyViewModel> _companies;
|
||||||
List<Iso31661Numeric> _countries;
|
List<Iso31661Numeric> _countries;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
@@ -118,6 +120,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
_logos = await CompanyLogosService.GetByCompany(Id);
|
_logos = await CompanyLogosService.GetByCompany(Id);
|
||||||
_description = await Service.GetDescriptionAsync(Id);
|
_description = await Service.GetDescriptionAsync(Id);
|
||||||
_selectedDescriptionTab = "markdown";
|
_selectedDescriptionTab = "markdown";
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/companies/edit/",
|
StartsWith("admin/companies/edit/",
|
||||||
@@ -246,9 +249,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
@@ -325,7 +328,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await CompanyLogosService.DeleteAsync(_currentLogo.Id);
|
await CompanyLogosService.DeleteAsync(_currentLogo.Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_logos = await CompanyLogosService.GetByCompany(Id);
|
_logos = await CompanyLogosService.GetByCompany(Id);
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
@@ -360,7 +365,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await CompanyLogosService.ChangeYearAsync(_currentLogo.Id, _unknownLogoYear ? null : _currentLogoYear);
|
await CompanyLogosService.ChangeYearAsync(_currentLogo.Id, _unknownLogoYear ? null : _currentLogoYear,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_logos = await CompanyLogosService.GetByCompany(Id);
|
_logos = await CompanyLogosService.GetByCompany(Id);
|
||||||
|
|
||||||
_yearChangeInProgress = false;
|
_yearChangeInProgress = false;
|
||||||
@@ -589,7 +596,8 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await CompanyLogosService.CreateAsync(Id, guid, _unknownLogoYear ? null : _currentLogoYear);
|
await CompanyLogosService.CreateAsync(Id, guid, _unknownLogoYear ? null : _currentLogoYear,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_logos = await CompanyLogosService.GetByCompany(Id);
|
_logos = await CompanyLogosService.GetByCompany(Id);
|
||||||
|
|
||||||
@@ -652,7 +660,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
|
|
||||||
_description.Html = Markdown.ToHtml(_description.Markdown, _pipeline);
|
_description.Html = Markdown.ToHtml(_description.Markdown, _pipeline);
|
||||||
|
|
||||||
await Service.CreateOrUpdateDescriptionAsync(Id, _description);
|
await Service.CreateOrUpdateDescriptionAsync(Id, _description,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_addingDescription = false;
|
_addingDescription = false;
|
||||||
await CancelDescription();
|
await CancelDescription();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -617,7 +617,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await Service.CreateAsync(_model);
|
await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
_addToDatabase = true;
|
_addToDatabase = true;
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
|
|||||||
@@ -28,10 +28,13 @@
|
|||||||
@page "/admin/document_companies/details/{Id:int}"
|
@page "/admin/document_companies/details/{Id:int}"
|
||||||
@page "/admin/document_companies/edit/{Id:int}"
|
@page "/admin/document_companies/edit/{Id:int}"
|
||||||
@page "/admin/document_companies/create"
|
@page "/admin/document_companies/create"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<DocumentCompaniesService>
|
@inherits OwningComponentBase<DocumentCompaniesService>
|
||||||
@inject IStringLocalizer<DocumentCompaniesService> L
|
@inject IStringLocalizer<DocumentCompaniesService> L
|
||||||
@inject CompaniesService CompaniesService
|
@inject CompaniesService CompaniesService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Document company details"]</h3>
|
<h3>@L["Document company details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -30,11 +30,13 @@ using Blazorise;
|
|||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
public partial class DocumentCompany
|
public partial class DocumentCompany
|
||||||
{
|
{
|
||||||
|
AuthenticationState _authState;
|
||||||
List<CompanyViewModel> _companies;
|
List<CompanyViewModel> _companies;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
bool _editing;
|
bool _editing;
|
||||||
@@ -63,6 +65,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
|
|
||||||
_companies = await CompaniesService.GetAsync();
|
_companies = await CompaniesService.GetAsync();
|
||||||
_model = _creating ? new DocumentCompanyViewModel() : await Service.GetAsync(Id);
|
_model = _creating ? new DocumentCompanyViewModel() : await Service.GetAsync(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/document_companies/edit/",
|
StartsWith("admin/document_companies/edit/",
|
||||||
@@ -116,9 +119,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
|
|||||||
@@ -28,10 +28,13 @@
|
|||||||
@page "/admin/document_people/details/{Id:int}"
|
@page "/admin/document_people/details/{Id:int}"
|
||||||
@page "/admin/document_people/edit/{Id:int}"
|
@page "/admin/document_people/edit/{Id:int}"
|
||||||
@page "/admin/document_people/create"
|
@page "/admin/document_people/create"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<DocumentPeopleService>
|
@inherits OwningComponentBase<DocumentPeopleService>
|
||||||
@inject IStringLocalizer<DocumentPeopleService> L
|
@inject IStringLocalizer<DocumentPeopleService> L
|
||||||
@inject PeopleService PeopleService
|
@inject PeopleService PeopleService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Document person details"]</h3>
|
<h3>@L["Document person details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -30,11 +30,13 @@ using Blazorise;
|
|||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
public partial class DocumentPerson
|
public partial class DocumentPerson
|
||||||
{
|
{
|
||||||
|
AuthenticationState _authState;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
bool _editing;
|
bool _editing;
|
||||||
bool _loaded;
|
bool _loaded;
|
||||||
@@ -63,8 +65,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
!_creating)
|
!_creating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_people = await PeopleService.GetAsync();
|
_people = await PeopleService.GetAsync();
|
||||||
_model = _creating ? new DocumentPersonViewModel() : await Service.GetAsync(Id);
|
_model = _creating ? new DocumentPersonViewModel() : await Service.GetAsync(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/document_people/edit/",
|
StartsWith("admin/document_people/edit/",
|
||||||
@@ -152,9 +155,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
|
|||||||
@@ -28,12 +28,15 @@
|
|||||||
@page "/admin/gpus/details/{Id:int}"
|
@page "/admin/gpus/details/{Id:int}"
|
||||||
@page "/admin/gpus/edit/{Id:int}"
|
@page "/admin/gpus/edit/{Id:int}"
|
||||||
@page "/admin/gpus/create"
|
@page "/admin/gpus/create"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<GpusService>
|
@inherits OwningComponentBase<GpusService>
|
||||||
@inject IStringLocalizer<GpusService> L
|
@inject IStringLocalizer<GpusService> L
|
||||||
@inject CompaniesService CompaniesService
|
@inject CompaniesService CompaniesService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject ResolutionsService ResolutionsService
|
@inject ResolutionsService ResolutionsService
|
||||||
@inject ResolutionsByGpuService ResolutionsByGpuService
|
@inject ResolutionsByGpuService ResolutionsByGpuService
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Graphical processing unit details"]</h3>
|
<h3>@L["Graphical processing unit details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ using Blazorise;
|
|||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
@@ -38,6 +39,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
{
|
{
|
||||||
bool _addingResolution;
|
bool _addingResolution;
|
||||||
int? _addingResolutionId;
|
int? _addingResolutionId;
|
||||||
|
AuthenticationState _authState;
|
||||||
List<CompanyViewModel> _companies;
|
List<CompanyViewModel> _companies;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
ResolutionByGpuViewModel _currentResolution;
|
ResolutionByGpuViewModel _currentResolution;
|
||||||
@@ -81,6 +83,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
_model = _creating ? new GpuViewModel() : await Service.GetAsync(Id);
|
_model = _creating ? new GpuViewModel() : await Service.GetAsync(Id);
|
||||||
_resolutions = await ResolutionsService.GetAsync();
|
_resolutions = await ResolutionsService.GetAsync();
|
||||||
_gpuResolutions = await ResolutionsByGpuService.GetByGpu(Id);
|
_gpuResolutions = await ResolutionsByGpuService.GetByGpu(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/gpus/edit/", StringComparison.InvariantCulture);
|
StartsWith("admin/gpus/edit/", StringComparison.InvariantCulture);
|
||||||
@@ -172,9 +175,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
@@ -225,7 +228,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await ResolutionsByGpuService.DeleteAsync(_currentResolution.Id);
|
await ResolutionsByGpuService.DeleteAsync(_currentResolution.Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_gpuResolutions = await ResolutionsByGpuService.GetByGpu(Id);
|
_gpuResolutions = await ResolutionsByGpuService.GetByGpu(Id);
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
@@ -273,7 +278,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await ResolutionsByGpuService.CreateAsync(_addingResolutionId.Value, Id);
|
await ResolutionsByGpuService.CreateAsync(_addingResolutionId.Value, Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_gpuResolutions = await ResolutionsByGpuService.GetByGpu(Id);
|
_gpuResolutions = await ResolutionsByGpuService.GetByGpu(Id);
|
||||||
|
|
||||||
_addingResolution = false;
|
_addingResolution = false;
|
||||||
|
|||||||
@@ -28,10 +28,13 @@
|
|||||||
@page "/admin/instruction_sets/details/{Id:int}"
|
@page "/admin/instruction_sets/details/{Id:int}"
|
||||||
@page "/admin/instruction_sets/edit/{Id:int}"
|
@page "/admin/instruction_sets/edit/{Id:int}"
|
||||||
@page "/admin/instruction_sets/create"
|
@page "/admin/instruction_sets/create"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<InstructionSetsService>
|
@inherits OwningComponentBase<InstructionSetsService>
|
||||||
@inject IStringLocalizer<InstructionSetsService> L
|
@inject IStringLocalizer<InstructionSetsService> L
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
<h3>@L["Instruction set details"]</h3>
|
<h3>@L["Instruction set details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,13 @@ using System.Threading.Tasks;
|
|||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
public partial class InstructionSet
|
public partial class InstructionSet
|
||||||
{
|
{
|
||||||
|
AuthenticationState _authState;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
bool _editing;
|
bool _editing;
|
||||||
bool _loaded;
|
bool _loaded;
|
||||||
@@ -55,7 +57,8 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
!_creating)
|
!_creating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_model = _creating ? new Database.Models.InstructionSet() : await Service.GetAsync(Id);
|
_model = _creating ? new Database.Models.InstructionSet() : await Service.GetAsync(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/instruction_sets/edit/",
|
StartsWith("admin/instruction_sets/edit/",
|
||||||
@@ -93,9 +96,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
|
|||||||
@@ -28,10 +28,13 @@
|
|||||||
@page "/admin/instruction_set_extensions/details/{Id:int}"
|
@page "/admin/instruction_set_extensions/details/{Id:int}"
|
||||||
@page "/admin/instruction_set_extensions/edit/{Id:int}"
|
@page "/admin/instruction_set_extensions/edit/{Id:int}"
|
||||||
@page "/admin/instruction_set_extensions/create"
|
@page "/admin/instruction_set_extensions/create"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<InstructionSetExtensionsService>
|
@inherits OwningComponentBase<InstructionSetExtensionsService>
|
||||||
@inject IStringLocalizer<InstructionSetExtensionsService> L
|
@inject IStringLocalizer<InstructionSetExtensionsService> L
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
<h3>@L["Instruction set extension details"]</h3>
|
<h3>@L["Instruction set extension details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,13 @@ using System.Threading.Tasks;
|
|||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
public partial class InstructionSetExtension
|
public partial class InstructionSetExtension
|
||||||
{
|
{
|
||||||
|
AuthenticationState _authState;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
bool _editing;
|
bool _editing;
|
||||||
bool _loaded;
|
bool _loaded;
|
||||||
@@ -55,7 +57,8 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
!_creating)
|
!_creating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_model = _creating ? new Database.Models.InstructionSetExtension() : await Service.GetAsync(Id);
|
_model = _creating ? new Database.Models.InstructionSetExtension() : await Service.GetAsync(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/instruction_set_extensions/edit/",
|
StartsWith("admin/instruction_set_extensions/edit/",
|
||||||
@@ -93,9 +96,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
|
|||||||
@@ -28,9 +28,12 @@
|
|||||||
@page "/admin/licenses/details/{Id:int}"
|
@page "/admin/licenses/details/{Id:int}"
|
||||||
@page "/admin/licenses/edit/{Id:int}"
|
@page "/admin/licenses/edit/{Id:int}"
|
||||||
@page "/admin/licenses/create"
|
@page "/admin/licenses/create"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<LicensesService>
|
@inherits OwningComponentBase<LicensesService>
|
||||||
@inject IStringLocalizer<LicensesService> L
|
@inject IStringLocalizer<LicensesService> L
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["License details"]</h3>
|
<h3>@L["License details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -28,11 +28,13 @@ using System.Threading.Tasks;
|
|||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
public partial class License
|
public partial class License
|
||||||
{
|
{
|
||||||
|
AuthenticationState _authState;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
bool _editing;
|
bool _editing;
|
||||||
bool _loaded;
|
bool _loaded;
|
||||||
@@ -56,7 +58,8 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
!_creating)
|
!_creating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_model = _creating ? new Database.Models.License() : await Service.GetAsync(Id);
|
_model = _creating ? new Database.Models.License() : await Service.GetAsync(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/licenses/edit/",
|
StartsWith("admin/licenses/edit/",
|
||||||
@@ -119,9 +122,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
@page "/admin/machines/edit/{Id:int}"
|
@page "/admin/machines/edit/{Id:int}"
|
||||||
@page "/admin/machines/create"
|
@page "/admin/machines/create"
|
||||||
@using Marechai.Database
|
@using Marechai.Database
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<MachinesService>
|
@inherits OwningComponentBase<MachinesService>
|
||||||
@inject IStringLocalizer<MachinesService> L
|
@inject IStringLocalizer<MachinesService> L
|
||||||
@inject CompaniesService CompaniesService
|
@inject CompaniesService CompaniesService
|
||||||
@@ -45,6 +46,8 @@
|
|||||||
@inject ScreensByMachineService ScreensByMachineService
|
@inject ScreensByMachineService ScreensByMachineService
|
||||||
@inject ScreensService ScreensService
|
@inject ScreensService ScreensService
|
||||||
@inject MachinePhotosService MachinePhotosService
|
@inject MachinePhotosService MachinePhotosService
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Machine details"]</h3>
|
<h3>@L["Machine details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ using Marechai.Database;
|
|||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
@@ -55,6 +56,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
int _addingStorageInterface;
|
int _addingStorageInterface;
|
||||||
long? _addingStorageSize;
|
long? _addingStorageSize;
|
||||||
int _addingStorageType;
|
int _addingStorageType;
|
||||||
|
AuthenticationState _authState;
|
||||||
List<CompanyViewModel> _companies;
|
List<CompanyViewModel> _companies;
|
||||||
List<ProcessorViewModel> _cpus;
|
List<ProcessorViewModel> _cpus;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
@@ -138,6 +140,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
_machineStorage = await StorageByMachineService.GetByMachine(Id);
|
_machineStorage = await StorageByMachineService.GetByMachine(Id);
|
||||||
_machineScreens = await ScreensByMachineService.GetByMachine(Id);
|
_machineScreens = await ScreensByMachineService.GetByMachine(Id);
|
||||||
_photos = await MachinePhotosService.GetGuidsByMachineAsync(Id);
|
_photos = await MachinePhotosService.GetGuidsByMachineAsync(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/machines/edit/",
|
StartsWith("admin/machines/edit/",
|
||||||
@@ -200,9 +203,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
@@ -260,7 +263,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await GpusByMachineService.DeleteAsync(_currentGpuByMachine.Id);
|
await GpusByMachineService.DeleteAsync(_currentGpuByMachine.Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_machineGpus = await GpusByMachineService.GetByMachine(Id);
|
_machineGpus = await GpusByMachineService.GetByMachine(Id);
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
@@ -317,7 +322,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await GpusByMachineService.CreateAsync(_addingGpuId.Value, Id);
|
await GpusByMachineService.CreateAsync(_addingGpuId.Value, Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_machineGpus = await GpusByMachineService.GetByMachine(Id);
|
_machineGpus = await GpusByMachineService.GetByMachine(Id);
|
||||||
|
|
||||||
_addingGpu = false;
|
_addingGpu = false;
|
||||||
@@ -354,7 +361,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await SoundSynthsByMachineService.DeleteAsync(_currentSoundByMachine.Id);
|
await SoundSynthsByMachineService.DeleteAsync(_currentSoundByMachine.Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_machineSound = await SoundSynthsByMachineService.GetByMachine(Id);
|
_machineSound = await SoundSynthsByMachineService.GetByMachine(Id);
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
@@ -396,7 +405,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await SoundSynthsByMachineService.CreateAsync(_addingSoundId.Value, Id);
|
await SoundSynthsByMachineService.CreateAsync(_addingSoundId.Value, Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_machineSound = await SoundSynthsByMachineService.GetByMachine(Id);
|
_machineSound = await SoundSynthsByMachineService.GetByMachine(Id);
|
||||||
|
|
||||||
_addingSound = false;
|
_addingSound = false;
|
||||||
@@ -436,7 +447,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await ProcessorsByMachineService.DeleteAsync(_currentCpuByMachine.Id);
|
await ProcessorsByMachineService.DeleteAsync(_currentCpuByMachine.Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_machineCpus = await ProcessorsByMachineService.GetByMachine(Id);
|
_machineCpus = await ProcessorsByMachineService.GetByMachine(Id);
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
@@ -481,7 +494,8 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await ProcessorsByMachineService.CreateAsync(_addingCpuId.Value, Id,
|
await ProcessorsByMachineService.CreateAsync(_addingCpuId.Value, Id,
|
||||||
_unknownProcessorSpeed ? null : _addingProcessorSpeed);
|
_unknownProcessorSpeed ? null : _addingProcessorSpeed,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_machineCpus = await ProcessorsByMachineService.GetByMachine(Id);
|
_machineCpus = await ProcessorsByMachineService.GetByMachine(Id);
|
||||||
|
|
||||||
@@ -531,7 +545,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await MemoriesByMachineService.DeleteAsync(_currentMemoryByMachine.Id);
|
await MemoriesByMachineService.DeleteAsync(_currentMemoryByMachine.Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_machineMemories = await MemoriesByMachineService.GetByMachine(Id);
|
_machineMemories = await MemoriesByMachineService.GetByMachine(Id);
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
@@ -572,7 +588,8 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
await MemoriesByMachineService.CreateAsync(Id, (MemoryType)_addingMemoryType,
|
await MemoriesByMachineService.CreateAsync(Id, (MemoryType)_addingMemoryType,
|
||||||
(MemoryUsage)_addingMemoryUsage,
|
(MemoryUsage)_addingMemoryUsage,
|
||||||
_unknownMemorySize ? null : _addingMemorySize,
|
_unknownMemorySize ? null : _addingMemorySize,
|
||||||
_unknownMemorySpeed ? null : _addingMemorySpeed);
|
_unknownMemorySpeed ? null : _addingMemorySpeed,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_machineMemories = await MemoriesByMachineService.GetByMachine(Id);
|
_machineMemories = await MemoriesByMachineService.GetByMachine(Id);
|
||||||
|
|
||||||
@@ -633,7 +650,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await StorageByMachineService.DeleteAsync(_currentStorageByMachine.Id);
|
await StorageByMachineService.DeleteAsync(_currentStorageByMachine.Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_machineStorage = await StorageByMachineService.GetByMachine(Id);
|
_machineStorage = await StorageByMachineService.GetByMachine(Id);
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
@@ -671,7 +690,8 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
|
|
||||||
await StorageByMachineService.CreateAsync(Id, (StorageType)_addingStorageType,
|
await StorageByMachineService.CreateAsync(Id, (StorageType)_addingStorageType,
|
||||||
(StorageInterface)_addingStorageInterface,
|
(StorageInterface)_addingStorageInterface,
|
||||||
_unknownStorageSize ? null : _addingStorageSize);
|
_unknownStorageSize ? null : _addingStorageSize,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_machineStorage = await StorageByMachineService.GetByMachine(Id);
|
_machineStorage = await StorageByMachineService.GetByMachine(Id);
|
||||||
|
|
||||||
@@ -717,7 +737,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await ScreensByMachineService.DeleteAsync(_currentScreenByMachine.Id);
|
await ScreensByMachineService.DeleteAsync(_currentScreenByMachine.Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_machineScreens = await ScreensByMachineService.GetByMachine(Id);
|
_machineScreens = await ScreensByMachineService.GetByMachine(Id);
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
@@ -759,7 +781,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await ScreensByMachineService.CreateAsync(_addingScreenId.Value, Id);
|
await ScreensByMachineService.CreateAsync(_addingScreenId.Value, Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_machineScreens = await ScreensByMachineService.GetByMachine(Id);
|
_machineScreens = await ScreensByMachineService.GetByMachine(Id);
|
||||||
|
|
||||||
_addingScreen = false;
|
_addingScreen = false;
|
||||||
|
|||||||
@@ -28,10 +28,13 @@
|
|||||||
@page "/admin/machine_families/details/{Id:int}"
|
@page "/admin/machine_families/details/{Id:int}"
|
||||||
@page "/admin/machine_families/edit/{Id:int}"
|
@page "/admin/machine_families/edit/{Id:int}"
|
||||||
@page "/admin/machine_families/create"
|
@page "/admin/machine_families/create"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<MachineFamiliesService>
|
@inherits OwningComponentBase<MachineFamiliesService>
|
||||||
@inject IStringLocalizer<MachineFamiliesService> L
|
@inject IStringLocalizer<MachineFamiliesService> L
|
||||||
@inject CompaniesService CompaniesService
|
@inject CompaniesService CompaniesService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Machine family details"]</h3>
|
<h3>@L["Machine family details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -30,11 +30,13 @@ using Blazorise;
|
|||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
public partial class MachineFamily
|
public partial class MachineFamily
|
||||||
{
|
{
|
||||||
|
AuthenticationState _authState;
|
||||||
List<CompanyViewModel> _companies;
|
List<CompanyViewModel> _companies;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
bool _editing;
|
bool _editing;
|
||||||
@@ -60,6 +62,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
|
|
||||||
_companies = await CompaniesService.GetAsync();
|
_companies = await CompaniesService.GetAsync();
|
||||||
_model = _creating ? new MachineFamilyViewModel() : await Service.GetAsync(Id);
|
_model = _creating ? new MachineFamilyViewModel() : await Service.GetAsync(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/machine_families/edit/",
|
StartsWith("admin/machine_families/edit/",
|
||||||
@@ -96,9 +99,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject LicensesService LicensesService
|
@inject LicensesService LicensesService
|
||||||
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Machine photo details"]</h3>
|
<h3>@L["Machine photo details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ using Marechai.Database.Models;
|
|||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
using Orientation = Marechai.Database.Orientation;
|
using Orientation = Marechai.Database.Orientation;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
@@ -39,6 +40,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
public partial class MachinePhoto
|
public partial class MachinePhoto
|
||||||
{
|
{
|
||||||
const int _maxUploadSize = 25 * 1048576;
|
const int _maxUploadSize = 25 * 1048576;
|
||||||
|
AuthenticationState _authState;
|
||||||
bool _editing;
|
bool _editing;
|
||||||
List<Database.Models.License> _licenses;
|
List<Database.Models.License> _licenses;
|
||||||
bool _loaded;
|
bool _loaded;
|
||||||
@@ -272,8 +274,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
if(Id == Guid.Empty)
|
if(Id == Guid.Empty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_model = await Service.GetAsync(Id);
|
_model = await Service.GetAsync(Id);
|
||||||
_licenses = await LicensesService.GetAsync();
|
_licenses = await LicensesService.GetAsync();
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/machines/photo/edit/", StringComparison.InvariantCulture);
|
StartsWith("admin/machines/photo/edit/", StringComparison.InvariantCulture);
|
||||||
@@ -341,7 +344,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
|
|
||||||
async void OnSaveClicked()
|
async void OnSaveClicked()
|
||||||
{
|
{
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_model = await Service.GetAsync(Id);
|
_model = await Service.GetAsync(Id);
|
||||||
SetCheckboxes();
|
SetCheckboxes();
|
||||||
|
|||||||
@@ -28,10 +28,13 @@
|
|||||||
@page "/admin/people/details/{Id:int}"
|
@page "/admin/people/details/{Id:int}"
|
||||||
@page "/admin/people/edit/{Id:int}"
|
@page "/admin/people/edit/{Id:int}"
|
||||||
@page "/admin/people/create"
|
@page "/admin/people/create"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<PeopleService>
|
@inherits OwningComponentBase<PeopleService>
|
||||||
@inject IStringLocalizer<PeopleService> L
|
@inject IStringLocalizer<PeopleService> L
|
||||||
@inject Iso31661NumericService CountriesService
|
@inject Iso31661NumericService CountriesService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Person details"]</h3>
|
<h3>@L["Person details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -31,11 +31,13 @@ using Marechai.Database.Models;
|
|||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
public partial class Person
|
public partial class Person
|
||||||
{
|
{
|
||||||
|
AuthenticationState _authState;
|
||||||
List<Iso31661Numeric> _countries;
|
List<Iso31661Numeric> _countries;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
bool _editing;
|
bool _editing;
|
||||||
@@ -69,6 +71,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
|
|
||||||
_countries = await CountriesService.GetAsync();
|
_countries = await CountriesService.GetAsync();
|
||||||
_model = _creating ? new PersonViewModel() : await Service.GetAsync(Id);
|
_model = _creating ? new PersonViewModel() : await Service.GetAsync(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/people/edit/",
|
StartsWith("admin/people/edit/",
|
||||||
@@ -185,9 +188,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
@page "/admin/processors/details/{Id:int}"
|
@page "/admin/processors/details/{Id:int}"
|
||||||
@page "/admin/processors/edit/{Id:int}"
|
@page "/admin/processors/edit/{Id:int}"
|
||||||
@page "/admin/processors/create"
|
@page "/admin/processors/create"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<ProcessorsService>
|
@inherits OwningComponentBase<ProcessorsService>
|
||||||
@inject IStringLocalizer<ProcessorsService> L
|
@inject IStringLocalizer<ProcessorsService> L
|
||||||
@inject CompaniesService CompaniesService
|
@inject CompaniesService CompaniesService
|
||||||
@@ -35,6 +36,8 @@
|
|||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject InstructionSetExtensionsByProcessorService InstructionSetExtensionsByProcessorService
|
@inject InstructionSetExtensionsByProcessorService InstructionSetExtensionsByProcessorService
|
||||||
@inject InstructionSetExtensionsService InstructionSetExtensionsService
|
@inject InstructionSetExtensionsService InstructionSetExtensionsService
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Processor details"]</h3>
|
<h3>@L["Processor details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -31,27 +31,27 @@ using Blazorise;
|
|||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
public partial class Processor
|
public partial class Processor
|
||||||
{
|
{
|
||||||
bool _addingExtension;
|
bool _addingExtension;
|
||||||
int? _addingExtensionId;
|
int? _addingExtensionId;
|
||||||
List<CompanyViewModel> _companies;
|
AuthenticationState _authState;
|
||||||
bool _creating;
|
List<CompanyViewModel> _companies;
|
||||||
|
bool _creating;
|
||||||
InstructionSetExtensionByProcessorViewModel _currentInstructionByMachine;
|
InstructionSetExtensionByProcessorViewModel _currentInstructionByMachine;
|
||||||
bool _deleteInProgress;
|
bool _deleteInProgress;
|
||||||
string _deleteText;
|
string _deleteText;
|
||||||
string _deleteTitle;
|
string _deleteTitle;
|
||||||
bool _editing;
|
bool _editing;
|
||||||
Modal _frmDelete;
|
Modal _frmDelete;
|
||||||
List<Database.Models.InstructionSetExtension> _instructionSetExtensions;
|
List<Database.Models.InstructionSetExtension> _instructionSetExtensions;
|
||||||
List<Database.Models.InstructionSet> _instructionSets;
|
List<Database.Models.InstructionSet> _instructionSets;
|
||||||
bool _loaded;
|
bool _loaded;
|
||||||
ProcessorViewModel _model;
|
ProcessorViewModel _model;
|
||||||
|
|
||||||
List<InstructionSetExtensionByProcessorViewModel> _processorExtensions;
|
List<InstructionSetExtensionByProcessorViewModel> _processorExtensions;
|
||||||
bool _prototype;
|
bool _prototype;
|
||||||
bool _savingExtension;
|
bool _savingExtension;
|
||||||
@@ -101,6 +101,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
_model = _creating ? new ProcessorViewModel() : await Service.GetAsync(Id);
|
_model = _creating ? new ProcessorViewModel() : await Service.GetAsync(Id);
|
||||||
_instructionSetExtensions = await InstructionSetExtensionsService.GetAsync();
|
_instructionSetExtensions = await InstructionSetExtensionsService.GetAsync();
|
||||||
_processorExtensions = await InstructionSetExtensionsByProcessorService.GetByProcessor(Id);
|
_processorExtensions = await InstructionSetExtensionsByProcessorService.GetByProcessor(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/processors/edit/",
|
StartsWith("admin/processors/edit/",
|
||||||
@@ -289,9 +290,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
@@ -350,7 +351,10 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await InstructionSetExtensionsByProcessorService.DeleteAsync(_currentInstructionByMachine.Id);
|
await InstructionSetExtensionsByProcessorService.DeleteAsync(_currentInstructionByMachine.Id,
|
||||||
|
(await UserManager.
|
||||||
|
GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_processorExtensions = await InstructionSetExtensionsByProcessorService.GetByProcessor(Id);
|
_processorExtensions = await InstructionSetExtensionsByProcessorService.GetByProcessor(Id);
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
@@ -398,7 +402,10 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await InstructionSetExtensionsByProcessorService.CreateAsync(Id, _addingExtensionId.Value);
|
await InstructionSetExtensionsByProcessorService.CreateAsync(Id, _addingExtensionId.Value,
|
||||||
|
(await UserManager.
|
||||||
|
GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_processorExtensions = await InstructionSetExtensionsByProcessorService.GetByProcessor(Id);
|
_processorExtensions = await InstructionSetExtensionsByProcessorService.GetByProcessor(Id);
|
||||||
|
|
||||||
_addingExtension = false;
|
_addingExtension = false;
|
||||||
|
|||||||
@@ -28,9 +28,12 @@
|
|||||||
@page "/admin/resolutions/details/{Id:int}"
|
@page "/admin/resolutions/details/{Id:int}"
|
||||||
@page "/admin/resolutions/edit/{Id:int}"
|
@page "/admin/resolutions/edit/{Id:int}"
|
||||||
@page "/admin/resolutions/create"
|
@page "/admin/resolutions/create"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<ResolutionsService>
|
@inherits OwningComponentBase<ResolutionsService>
|
||||||
@inject IStringLocalizer<ResolutionsService> L
|
@inject IStringLocalizer<ResolutionsService> L
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Resolution details"]</h3>
|
<h3>@L["Resolution details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -29,11 +29,13 @@ using Blazorise;
|
|||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
public partial class Resolution
|
public partial class Resolution
|
||||||
{
|
{
|
||||||
|
AuthenticationState _authState;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
bool _editing;
|
bool _editing;
|
||||||
bool _loaded;
|
bool _loaded;
|
||||||
@@ -57,7 +59,8 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
!_creating)
|
!_creating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_model = _creating ? new ResolutionViewModel() : await Service.GetAsync(Id);
|
_model = _creating ? new ResolutionViewModel() : await Service.GetAsync(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/resolutions/edit/",
|
StartsWith("admin/resolutions/edit/",
|
||||||
@@ -111,9 +114,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
|
|||||||
@@ -28,12 +28,14 @@
|
|||||||
@page "/admin/screens/details/{Id:int}"
|
@page "/admin/screens/details/{Id:int}"
|
||||||
@page "/admin/screens/edit/{Id:int}"
|
@page "/admin/screens/edit/{Id:int}"
|
||||||
@page "/admin/screens/create"
|
@page "/admin/screens/create"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<ScreensService>
|
@inherits OwningComponentBase<ScreensService>
|
||||||
@inject IStringLocalizer<ScreensService> L
|
@inject IStringLocalizer<ScreensService> L
|
||||||
@inject ResolutionsService ResolutionsService
|
@inject ResolutionsService ResolutionsService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject ResolutionsByScreenService ResolutionsByScreenService
|
@inject ResolutionsByScreenService ResolutionsByScreenService
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Screen details"]</h3>
|
<h3>@L["Screen details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ using Blazorise;
|
|||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
@@ -38,6 +39,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
{
|
{
|
||||||
bool _addingResolution;
|
bool _addingResolution;
|
||||||
int? _addingResolutionId;
|
int? _addingResolutionId;
|
||||||
|
AuthenticationState _authState;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
ResolutionByScreenViewModel _currentResolution;
|
ResolutionByScreenViewModel _currentResolution;
|
||||||
bool _deleteInProgress;
|
bool _deleteInProgress;
|
||||||
@@ -74,6 +76,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
_resolutions = await ResolutionsService.GetAsync();
|
_resolutions = await ResolutionsService.GetAsync();
|
||||||
_model = _creating ? new ScreenViewModel() : await Service.GetAsync(Id);
|
_model = _creating ? new ScreenViewModel() : await Service.GetAsync(Id);
|
||||||
_screenResolutions = await ResolutionsByScreenService.GetByScreen(Id);
|
_screenResolutions = await ResolutionsByScreenService.GetByScreen(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/screens/edit/",
|
StartsWith("admin/screens/edit/",
|
||||||
@@ -139,9 +142,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
@@ -180,7 +183,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await ResolutionsByScreenService.DeleteAsync(_currentResolution.Id);
|
await ResolutionsByScreenService.DeleteAsync(_currentResolution.Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_screenResolutions = await ResolutionsByScreenService.GetByScreen(Id);
|
_screenResolutions = await ResolutionsByScreenService.GetByScreen(Id);
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
@@ -228,7 +233,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await ResolutionsByScreenService.CreateAsync(_addingResolutionId.Value, Id);
|
await ResolutionsByScreenService.CreateAsync(_addingResolutionId.Value, Id,
|
||||||
|
(await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_screenResolutions = await ResolutionsByScreenService.GetByScreen(Id);
|
_screenResolutions = await ResolutionsByScreenService.GetByScreen(Id);
|
||||||
|
|
||||||
_addingResolution = false;
|
_addingResolution = false;
|
||||||
|
|||||||
@@ -28,10 +28,13 @@
|
|||||||
@page "/admin/sound_synths/details/{Id:int}"
|
@page "/admin/sound_synths/details/{Id:int}"
|
||||||
@page "/admin/sound_synths/edit/{Id:int}"
|
@page "/admin/sound_synths/edit/{Id:int}"
|
||||||
@page "/admin/sound_synths/create"
|
@page "/admin/sound_synths/create"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<SoundSynthsService>
|
@inherits OwningComponentBase<SoundSynthsService>
|
||||||
@inject IStringLocalizer<SoundSynthsService> L
|
@inject IStringLocalizer<SoundSynthsService> L
|
||||||
@inject CompaniesService CompaniesService
|
@inject CompaniesService CompaniesService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Sound synthesizer details"]</h3>
|
<h3>@L["Sound synthesizer details"]</h3>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -30,11 +30,13 @@ using Blazorise;
|
|||||||
using Marechai.Shared;
|
using Marechai.Shared;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin.Details
|
namespace Marechai.Pages.Admin.Details
|
||||||
{
|
{
|
||||||
public partial class SoundSynth
|
public partial class SoundSynth
|
||||||
{
|
{
|
||||||
|
AuthenticationState _authState;
|
||||||
List<CompanyViewModel> _companies;
|
List<CompanyViewModel> _companies;
|
||||||
bool _creating;
|
bool _creating;
|
||||||
bool _editing;
|
bool _editing;
|
||||||
@@ -69,6 +71,7 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
|
|
||||||
_companies = await CompaniesService.GetAsync();
|
_companies = await CompaniesService.GetAsync();
|
||||||
_model = _creating ? new SoundSynthViewModel() : await Service.GetAsync(Id);
|
_model = _creating ? new SoundSynthViewModel() : await Service.GetAsync(Id);
|
||||||
|
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||||
StartsWith("admin/sound_synths/edit/",
|
StartsWith("admin/sound_synths/edit/",
|
||||||
@@ -167,9 +170,9 @@ namespace Marechai.Pages.Admin.Details
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(_creating)
|
if(_creating)
|
||||||
Id = await Service.CreateAsync(_model);
|
Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
else
|
else
|
||||||
await Service.UpdateAsync(_model);
|
await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
|
||||||
|
|
||||||
_editing = false;
|
_editing = false;
|
||||||
_creating = false;
|
_creating = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/document_companies"
|
@page "/admin/document_companies"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<DocumentCompaniesService>
|
@inherits OwningComponentBase<DocumentCompaniesService>
|
||||||
@inject IStringLocalizer<DocumentCompaniesService> L
|
@inject IStringLocalizer<DocumentCompaniesService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Document companies"]</h3>
|
<h3>@L["Document companies"]</h3>
|
||||||
@if (_companies is null)
|
@if (_companies is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -56,11 +57,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_companies = null;
|
_companies = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_currentCompany.Id);
|
await Service.DeleteAsync(_currentCompany.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_companies = await Service.GetAsync();
|
_companies = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/document_people"
|
@page "/admin/document_people"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<DocumentPeopleService>
|
@inherits OwningComponentBase<DocumentPeopleService>
|
||||||
@inject IStringLocalizer<DocumentPeopleService> L
|
@inject IStringLocalizer<DocumentPeopleService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Document companies"]</h3>
|
<h3>@L["Document companies"]</h3>
|
||||||
@if (_people is null)
|
@if (_people is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -53,11 +54,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_people = null;
|
_people = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_person.Id);
|
await Service.DeleteAsync(_person.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_people = await Service.GetAsync();
|
_people = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/gpus"
|
@page "/admin/gpus"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<GpusService>
|
@inherits OwningComponentBase<GpusService>
|
||||||
@inject IStringLocalizer<GpusService> L
|
@inject IStringLocalizer<GpusService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Graphics Processing Units"]</h3>
|
<h3>@L["Graphics Processing Units"]</h3>
|
||||||
@if (_gpus is null)
|
@if (_gpus is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -53,11 +54,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_gpus = null;
|
_gpus = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_gpu.Id);
|
await Service.DeleteAsync(_gpu.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_gpus = await Service.GetAsync();
|
_gpus = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/instruction_set_extensions"
|
@page "/admin/instruction_set_extensions"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<InstructionSetExtensionsService>
|
@inherits OwningComponentBase<InstructionSetExtensionsService>
|
||||||
@inject IStringLocalizer<InstructionSetExtensionsService> L
|
@inject IStringLocalizer<InstructionSetExtensionsService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Instruction set extensions"]</h3>
|
<h3>@L["Instruction set extensions"]</h3>
|
||||||
@if (_extensions is null)
|
@if (_extensions is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.Database.Models;
|
using Marechai.Database.Models;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -53,11 +54,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_extensions = null;
|
_extensions = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_extension.Id);
|
await Service.DeleteAsync(_extension.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_extensions = await Service.GetAsync();
|
_extensions = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/instruction_sets"
|
@page "/admin/instruction_sets"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<InstructionSetsService>
|
@inherits OwningComponentBase<InstructionSetsService>
|
||||||
@inject IStringLocalizer<InstructionSetsService> L
|
@inject IStringLocalizer<InstructionSetsService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Instruction sets"]</h3>
|
<h3>@L["Instruction sets"]</h3>
|
||||||
@if (_instructionSets is null)
|
@if (_instructionSets is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.Database.Models;
|
using Marechai.Database.Models;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -53,11 +54,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_instructionSets = null;
|
_instructionSets = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_instructionSet.Id);
|
await Service.DeleteAsync(_instructionSet.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_instructionSets = await Service.GetAsync();
|
_instructionSets = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/licenses"
|
@page "/admin/licenses"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<LicensesService>
|
@inherits OwningComponentBase<LicensesService>
|
||||||
@inject IStringLocalizer<LicensesService> L
|
@inject IStringLocalizer<LicensesService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Licenses"]</h3>
|
<h3>@L["Licenses"]</h3>
|
||||||
@if (_licenses is null)
|
@if (_licenses is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.Database.Models;
|
using Marechai.Database.Models;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -53,11 +54,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_licenses = null;
|
_licenses = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_license.Id);
|
await Service.DeleteAsync(_license.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_licenses = await Service.GetAsync();
|
_licenses = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/machine_families"
|
@page "/admin/machine_families"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<MachineFamiliesService>
|
@inherits OwningComponentBase<MachineFamiliesService>
|
||||||
@inject IStringLocalizer<MachineFamiliesService> L
|
@inject IStringLocalizer<MachineFamiliesService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Machine families"]</h3>
|
<h3>@L["Machine families"]</h3>
|
||||||
@if (_machineFamilies is null)
|
@if (_machineFamilies is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -53,11 +54,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_machineFamilies = null;
|
_machineFamilies = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_machineFamily.Id);
|
await Service.DeleteAsync(_machineFamily.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_machineFamilies = await Service.GetAsync();
|
_machineFamilies = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/machines"
|
@page "/admin/machines"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<MachinesService>
|
@inherits OwningComponentBase<MachinesService>
|
||||||
@inject IStringLocalizer<MachinesService> L
|
@inject IStringLocalizer<MachinesService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Machines"]</h3>
|
<h3>@L["Machines"]</h3>
|
||||||
@if (_machines is null)
|
@if (_machines is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -53,11 +54,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_machines = null;
|
_machines = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_machine.Id);
|
await Service.DeleteAsync(_machine.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_machines = await Service.GetAsync();
|
_machines = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/news"
|
@page "/admin/news"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<NewsService>
|
@inherits OwningComponentBase<NewsService>
|
||||||
@inject IStringLocalizer<NewsService> L
|
@inject IStringLocalizer<NewsService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["News"]</h3>
|
<h3>@L["News"]</h3>
|
||||||
@if (_news is null)
|
@if (_news is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -55,11 +56,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_news = null;
|
_news = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_currentNews.Id);
|
await Service.DeleteAsync(_currentNews.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_news = await Service.GetAsync();
|
_news = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/people"
|
@page "/admin/people"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<PeopleService>
|
@inherits OwningComponentBase<PeopleService>
|
||||||
@inject IStringLocalizer<PeopleService> L
|
@inject IStringLocalizer<PeopleService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["People"]</h3>
|
<h3>@L["People"]</h3>
|
||||||
@if (_people is null)
|
@if (_people is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -53,11 +54,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_people = null;
|
_people = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_person.Id);
|
await Service.DeleteAsync(_person.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_people = await Service.GetAsync();
|
_people = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/processors"
|
@page "/admin/processors"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<ProcessorsService>
|
@inherits OwningComponentBase<ProcessorsService>
|
||||||
@inject IStringLocalizer<ProcessorsService> L
|
@inject IStringLocalizer<ProcessorsService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Processors"]</h3>
|
<h3>@L["Processors"]</h3>
|
||||||
@if (_processors is null)
|
@if (_processors is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -53,11 +54,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_processors = null;
|
_processors = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_processor.Id);
|
await Service.DeleteAsync(_processor.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_processors = await Service.GetAsync();
|
_processors = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/resolutions"
|
@page "/admin/resolutions"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<ResolutionsService>
|
@inherits OwningComponentBase<ResolutionsService>
|
||||||
@inject IStringLocalizer<ResolutionsService> L
|
@inject IStringLocalizer<ResolutionsService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Resolutions"]</h3>
|
<h3>@L["Resolutions"]</h3>
|
||||||
@if (_resolutions is null)
|
@if (_resolutions is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -53,11 +54,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_resolutions = null;
|
_resolutions = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_resolution.Id);
|
await Service.DeleteAsync(_resolution.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_resolutions = await Service.GetAsync();
|
_resolutions = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/screens"
|
@page "/admin/screens"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<ScreensService>
|
@inherits OwningComponentBase<ScreensService>
|
||||||
@inject IStringLocalizer<ScreensService> L
|
@inject IStringLocalizer<ScreensService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Screens"]</h3>
|
<h3>@L["Screens"]</h3>
|
||||||
@if (_screens is null)
|
@if (_screens is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -53,11 +54,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_screens = null;
|
_screens = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_screen.Id);
|
await Service.DeleteAsync(_screen.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_screens = await Service.GetAsync();
|
_screens = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@page "/admin/sound_synths"
|
@page "/admin/sound_synths"
|
||||||
|
@using Marechai.Database.Models
|
||||||
@inherits OwningComponentBase<SoundSynthsService>
|
@inherits OwningComponentBase<SoundSynthsService>
|
||||||
@inject IStringLocalizer<SoundSynthsService> L
|
@inject IStringLocalizer<SoundSynthsService> L
|
||||||
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
||||||
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
<h3>@L["Sound synthesizers"]</h3>
|
<h3>@L["Sound synthesizers"]</h3>
|
||||||
@if (_soundSynths is null)
|
@if (_soundSynths is null)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Blazorise;
|
using Blazorise;
|
||||||
using Marechai.ViewModels;
|
using Marechai.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
|
|
||||||
namespace Marechai.Pages.Admin
|
namespace Marechai.Pages.Admin
|
||||||
{
|
{
|
||||||
@@ -53,11 +54,12 @@ namespace Marechai.Pages.Admin
|
|||||||
|
|
||||||
_deleteInProgress = true;
|
_deleteInProgress = true;
|
||||||
_soundSynths = null;
|
_soundSynths = null;
|
||||||
|
AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
|
||||||
// Yield thread to let UI to update
|
// Yield thread to let UI to update
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
await Service.DeleteAsync(_soundSynth.Id);
|
await Service.DeleteAsync(_soundSynth.Id, (await UserManager.GetUserAsync(authState.User)).Id);
|
||||||
_soundSynths = await Service.GetAsync();
|
_soundSynths = await Service.GetAsync();
|
||||||
|
|
||||||
_deleteInProgress = false;
|
_deleteInProgress = false;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace Marechai.Services
|
|||||||
Country = c.Country.Name
|
Country = c.Country.Name
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(CompanyViewModel viewModel)
|
public async Task UpdateAsync(CompanyViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
Company model = await _context.Companies.FindAsync(viewModel.Id);
|
Company model = await _context.Companies.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -107,10 +107,10 @@ namespace Marechai.Services
|
|||||||
model.Province = viewModel.Province;
|
model.Province = viewModel.Province;
|
||||||
model.PostalCode = viewModel.PostalCode;
|
model.PostalCode = viewModel.PostalCode;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(CompanyViewModel viewModel)
|
public async Task<int> CreateAsync(CompanyViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new Company
|
var model = new Company
|
||||||
{
|
{
|
||||||
@@ -122,7 +122,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.Companies.AddAsync(model);
|
await _context.Companies.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ namespace Marechai.Services
|
|||||||
Name = c.Name
|
Name = c.Name
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
Company item = await _context.Companies.FindAsync(id);
|
Company item = await _context.Companies.FindAsync(id);
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.Companies.Remove(item);
|
_context.Companies.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<CompanyDescriptionViewModel> GetDescriptionAsync(int id) => await _context.
|
public async Task<CompanyDescriptionViewModel> GetDescriptionAsync(int id) => await _context.
|
||||||
@@ -219,7 +219,8 @@ namespace Marechai.Services
|
|||||||
}).
|
}).
|
||||||
FirstOrDefaultAsync();
|
FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task<int> CreateOrUpdateDescriptionAsync(int id, CompanyDescriptionViewModel description)
|
public async Task<int> CreateOrUpdateDescriptionAsync(int id, CompanyDescriptionViewModel description,
|
||||||
|
string userId)
|
||||||
{
|
{
|
||||||
CompanyDescription current = await _context.CompanyDescriptions.FirstOrDefaultAsync(d => d.CompanyId == id);
|
CompanyDescription current = await _context.CompanyDescriptions.FirstOrDefaultAsync(d => d.CompanyId == id);
|
||||||
|
|
||||||
@@ -238,7 +239,7 @@ namespace Marechai.Services
|
|||||||
current.Text = description.Markdown;
|
current.Text = description.Markdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return current.Id;
|
return current.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Marechai.Services
|
|||||||
public async Task<List<CompanyLogo>> GetByCompany(int companyId) =>
|
public async Task<List<CompanyLogo>> GetByCompany(int companyId) =>
|
||||||
await _context.CompanyLogos.Where(l => l.CompanyId == companyId).OrderBy(l => l.Year).ToListAsync();
|
await _context.CompanyLogos.Where(l => l.CompanyId == companyId).OrderBy(l => l.Year).ToListAsync();
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
CompanyLogo logo = await _context.CompanyLogos.Where(l => l.Id == id).FirstOrDefaultAsync();
|
CompanyLogo logo = await _context.CompanyLogos.Where(l => l.Id == id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ namespace Marechai.Services
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_context.CompanyLogos.Remove(logo);
|
_context.CompanyLogos.Remove(logo);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
if(File.Exists(Path.Combine(_webRootPath, "assets/logos", logo.Guid + ".svg")))
|
if(File.Exists(Path.Combine(_webRootPath, "assets/logos", logo.Guid + ".svg")))
|
||||||
File.Delete(Path.Combine(_webRootPath, "assets/logos", logo.Guid + ".svg"));
|
File.Delete(Path.Combine(_webRootPath, "assets/logos", logo.Guid + ".svg"));
|
||||||
@@ -100,7 +100,7 @@ namespace Marechai.Services
|
|||||||
File.Delete(Path.Combine(_webRootPath, "assets/logos/thumbs/png/3x", logo.Guid + ".png"));
|
File.Delete(Path.Combine(_webRootPath, "assets/logos/thumbs/png/3x", logo.Guid + ".png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ChangeYearAsync(int id, int? year)
|
public async Task ChangeYearAsync(int id, int? year, string userId)
|
||||||
{
|
{
|
||||||
CompanyLogo logo = await _context.CompanyLogos.Where(l => l.Id == id).FirstOrDefaultAsync();
|
CompanyLogo logo = await _context.CompanyLogos.Where(l => l.Id == id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
@@ -108,10 +108,10 @@ namespace Marechai.Services
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
logo.Year = year;
|
logo.Year = year;
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(int companyId, Guid guid, int? year)
|
public async Task<int> CreateAsync(int companyId, Guid guid, int? year, string userId)
|
||||||
{
|
{
|
||||||
var logo = new CompanyLogo
|
var logo = new CompanyLogo
|
||||||
{
|
{
|
||||||
@@ -119,7 +119,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.CompanyLogos.AddAsync(logo);
|
await _context.CompanyLogos.AddAsync(logo);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return logo.Id;
|
return logo.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Marechai.Services
|
|||||||
Id = d.Id, Name = d.Name, CompanyId = d.CompanyId
|
Id = d.Id, Name = d.Name, CompanyId = d.CompanyId
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(DocumentCompanyViewModel viewModel)
|
public async Task UpdateAsync(DocumentCompanyViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
DocumentCompany model = await _context.DocumentCompanies.FindAsync(viewModel.Id);
|
DocumentCompany model = await _context.DocumentCompanies.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -63,10 +63,10 @@ namespace Marechai.Services
|
|||||||
model.CompanyId = viewModel.CompanyId;
|
model.CompanyId = viewModel.CompanyId;
|
||||||
model.Name = viewModel.Name;
|
model.Name = viewModel.Name;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(DocumentCompanyViewModel viewModel)
|
public async Task<int> CreateAsync(DocumentCompanyViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new DocumentCompany
|
var model = new DocumentCompany
|
||||||
{
|
{
|
||||||
@@ -74,12 +74,12 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.DocumentCompanies.AddAsync(model);
|
await _context.DocumentCompanies.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
DocumentCompany item = await _context.DocumentCompanies.FindAsync(id);
|
DocumentCompany item = await _context.DocumentCompanies.FindAsync(id);
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.DocumentCompanies.Remove(item);
|
_context.DocumentCompanies.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ namespace Marechai.Services
|
|||||||
DisplayName = d.DisplayName, PersonId = d.PersonId
|
DisplayName = d.DisplayName, PersonId = d.PersonId
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(DocumentPersonViewModel viewModel)
|
public async Task UpdateAsync(DocumentPersonViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
DocumentPerson model = await _context.DocumentPeople.FindAsync(viewModel.Id);
|
DocumentPerson model = await _context.DocumentPeople.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -69,10 +69,10 @@ namespace Marechai.Services
|
|||||||
model.DisplayName = viewModel.DisplayName;
|
model.DisplayName = viewModel.DisplayName;
|
||||||
model.PersonId = viewModel.PersonId;
|
model.PersonId = viewModel.PersonId;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(DocumentPersonViewModel viewModel)
|
public async Task<int> CreateAsync(DocumentPersonViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new DocumentPerson
|
var model = new DocumentPerson
|
||||||
{
|
{
|
||||||
@@ -81,12 +81,12 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.AddAsync(model);
|
await _context.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
DocumentPerson item = await _context.DocumentPeople.FindAsync(id);
|
DocumentPerson item = await _context.DocumentPeople.FindAsync(id);
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.DocumentPeople.Remove(item);
|
_context.DocumentPeople.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ namespace Marechai.Services
|
|||||||
MachineId = g.MachineId
|
MachineId = g.MachineId
|
||||||
}).OrderBy(g => g.CompanyName).ThenBy(g => g.Name).ToListAsync();
|
}).OrderBy(g => g.CompanyName).ThenBy(g => g.Name).ToListAsync();
|
||||||
|
|
||||||
public async Task DeleteAsync(long id)
|
public async Task DeleteAsync(long id, string userId)
|
||||||
{
|
{
|
||||||
GpusByMachine item = await _context.GpusByMachine.FindAsync(id);
|
GpusByMachine item = await _context.GpusByMachine.FindAsync(id);
|
||||||
|
|
||||||
@@ -54,10 +54,10 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.GpusByMachine.Remove(item);
|
_context.GpusByMachine.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<long> CreateAsync(int gpuId, int machineId)
|
public async Task<long> CreateAsync(int gpuId, int machineId, string userId)
|
||||||
{
|
{
|
||||||
var item = new GpusByMachine
|
var item = new GpusByMachine
|
||||||
{
|
{
|
||||||
@@ -65,7 +65,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.GpusByMachine.AddAsync(item);
|
await _context.GpusByMachine.AddAsync(item);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return item.Id;
|
return item.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace Marechai.Services
|
|||||||
DieSize = g.DieSize, Transistors = g.Transistors
|
DieSize = g.DieSize, Transistors = g.Transistors
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(GpuViewModel viewModel)
|
public async Task UpdateAsync(GpuViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
Gpu model = await _context.Gpus.FindAsync(viewModel.Id);
|
Gpu model = await _context.Gpus.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -81,10 +81,10 @@ namespace Marechai.Services
|
|||||||
model.DieSize = viewModel.DieSize;
|
model.DieSize = viewModel.DieSize;
|
||||||
model.Transistors = viewModel.Transistors;
|
model.Transistors = viewModel.Transistors;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(GpuViewModel viewModel)
|
public async Task<int> CreateAsync(GpuViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new Gpu
|
var model = new Gpu
|
||||||
{
|
{
|
||||||
@@ -94,12 +94,12 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.Gpus.AddAsync(model);
|
await _context.Gpus.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
Gpu item = await _context.Gpus.FindAsync(id);
|
Gpu item = await _context.Gpus.FindAsync(id);
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.Gpus.Remove(item);
|
_context.Gpus.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ namespace Marechai.Services
|
|||||||
ProcessorId = e.ProcessorId, ExtensionId = e.ExtensionId
|
ProcessorId = e.ProcessorId, ExtensionId = e.ExtensionId
|
||||||
}).OrderBy(e => e.Extension).ToListAsync();
|
}).OrderBy(e => e.Extension).ToListAsync();
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
InstructionSetExtensionsByProcessor item = await _context.InstructionSetExtensionsByProcessor.FindAsync(id);
|
InstructionSetExtensionsByProcessor item = await _context.InstructionSetExtensionsByProcessor.FindAsync(id);
|
||||||
|
|
||||||
@@ -55,10 +55,10 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.InstructionSetExtensionsByProcessor.Remove(item);
|
_context.InstructionSetExtensionsByProcessor.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(int processorId, int extensionId)
|
public async Task<int> CreateAsync(int processorId, int extensionId, string userId)
|
||||||
{
|
{
|
||||||
var item = new InstructionSetExtensionsByProcessor
|
var item = new InstructionSetExtensionsByProcessor
|
||||||
{
|
{
|
||||||
@@ -66,7 +66,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.InstructionSetExtensionsByProcessor.AddAsync(item);
|
await _context.InstructionSetExtensionsByProcessor.AddAsync(item);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return item.Id;
|
return item.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Marechai.Services
|
|||||||
Extension = e.Extension, Id = e.Id
|
Extension = e.Extension, Id = e.Id
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(InstructionSetExtension viewModel)
|
public async Task UpdateAsync(InstructionSetExtension viewModel, string userId)
|
||||||
{
|
{
|
||||||
InstructionSetExtension model = await _context.InstructionSetExtensions.FindAsync(viewModel.Id);
|
InstructionSetExtension model = await _context.InstructionSetExtensions.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -59,10 +59,10 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
model.Extension = viewModel.Extension;
|
model.Extension = viewModel.Extension;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(InstructionSetExtension viewModel)
|
public async Task<int> CreateAsync(InstructionSetExtension viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new InstructionSetExtension
|
var model = new InstructionSetExtension
|
||||||
{
|
{
|
||||||
@@ -70,12 +70,12 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.InstructionSetExtensions.AddAsync(model);
|
await _context.InstructionSetExtensions.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
InstructionSetExtension item = await _context.InstructionSetExtensions.FindAsync(id);
|
InstructionSetExtension item = await _context.InstructionSetExtensions.FindAsync(id);
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.InstructionSetExtensions.Remove(item);
|
_context.InstructionSetExtensions.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool VerifyUnique(string extension) =>
|
public bool VerifyUnique(string extension) =>
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Marechai.Services
|
|||||||
Name = e.Name, Id = e.Id
|
Name = e.Name, Id = e.Id
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(InstructionSet viewModel)
|
public async Task UpdateAsync(InstructionSet viewModel, string userId)
|
||||||
{
|
{
|
||||||
InstructionSet model = await _context.InstructionSets.FindAsync(viewModel.Id);
|
InstructionSet model = await _context.InstructionSets.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -59,10 +59,10 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
model.Name = viewModel.Name;
|
model.Name = viewModel.Name;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(InstructionSet viewModel)
|
public async Task<int> CreateAsync(InstructionSet viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new InstructionSet
|
var model = new InstructionSet
|
||||||
{
|
{
|
||||||
@@ -70,12 +70,12 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.InstructionSets.AddAsync(model);
|
await _context.InstructionSets.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
InstructionSet item = await _context.InstructionSets.FindAsync(id);
|
InstructionSet item = await _context.InstructionSets.FindAsync(id);
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.InstructionSets.Remove(item);
|
_context.InstructionSets.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool VerifyUnique(string name) =>
|
public bool VerifyUnique(string name) =>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Marechai.Services
|
|||||||
OsiApproved = l.OsiApproved, SPDX = l.SPDX, Text = l.Text
|
OsiApproved = l.OsiApproved, SPDX = l.SPDX, Text = l.Text
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(License viewModel)
|
public async Task UpdateAsync(License viewModel, string userId)
|
||||||
{
|
{
|
||||||
License model = await _context.Licenses.FindAsync(viewModel.Id);
|
License model = await _context.Licenses.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -65,10 +65,10 @@ namespace Marechai.Services
|
|||||||
model.SPDX = viewModel.SPDX;
|
model.SPDX = viewModel.SPDX;
|
||||||
model.Text = viewModel.Text;
|
model.Text = viewModel.Text;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(License viewModel)
|
public async Task<int> CreateAsync(License viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new License
|
var model = new License
|
||||||
{
|
{
|
||||||
@@ -77,12 +77,12 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.Licenses.AddAsync(model);
|
await _context.Licenses.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
License item = await _context.Licenses.FindAsync(id);
|
License item = await _context.Licenses.FindAsync(id);
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.Licenses.Remove(item);
|
_context.Licenses.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ namespace Marechai.Services
|
|||||||
Id = m.Id, CompanyId = m.CompanyId, Name = m.Name
|
Id = m.Id, CompanyId = m.CompanyId, Name = m.Name
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(MachineFamilyViewModel viewModel)
|
public async Task UpdateAsync(MachineFamilyViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
MachineFamily model = await _context.MachineFamilies.FindAsync(viewModel.Id);
|
MachineFamily model = await _context.MachineFamilies.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -61,10 +61,10 @@ namespace Marechai.Services
|
|||||||
model.Name = viewModel.Name;
|
model.Name = viewModel.Name;
|
||||||
model.CompanyId = viewModel.CompanyId;
|
model.CompanyId = viewModel.CompanyId;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(MachineFamilyViewModel viewModel)
|
public async Task<int> CreateAsync(MachineFamilyViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new MachineFamily
|
var model = new MachineFamily
|
||||||
{
|
{
|
||||||
@@ -72,12 +72,12 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.MachineFamilies.AddAsync(model);
|
await _context.MachineFamilies.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
MachineFamily item = await _context.MachineFamilies.FindAsync(id);
|
MachineFamily item = await _context.MachineFamilies.FindAsync(id);
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.MachineFamilies.Remove(item);
|
_context.MachineFamilies.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ namespace Marechai.Services
|
|||||||
WhiteBalance = p.WhiteBalance, OriginalExtension = p.OriginalExtension
|
WhiteBalance = p.WhiteBalance, OriginalExtension = p.OriginalExtension
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(MachinePhotoViewModel viewModel)
|
public async Task UpdateAsync(MachinePhotoViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
MachinePhoto model = await _context.MachinePhotos.FindAsync(viewModel.Id);
|
MachinePhoto model = await _context.MachinePhotos.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -104,10 +104,10 @@ namespace Marechai.Services
|
|||||||
model.VerticalResolution = viewModel.VerticalResolution;
|
model.VerticalResolution = viewModel.VerticalResolution;
|
||||||
model.WhiteBalance = viewModel.WhiteBalance;
|
model.WhiteBalance = viewModel.WhiteBalance;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Guid> CreateAsync(MachinePhotoViewModel viewModel)
|
public async Task<Guid> CreateAsync(MachinePhotoViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new MachinePhoto
|
var model = new MachinePhoto
|
||||||
{
|
{
|
||||||
@@ -132,7 +132,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.MachinePhotos.AddAsync(model);
|
await _context.MachinePhotos.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace Marechai.Services
|
|||||||
Type = m.Type, FamilyId = m.FamilyId
|
Type = m.Type, FamilyId = m.FamilyId
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(MachineViewModel viewModel)
|
public async Task UpdateAsync(MachineViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
Machine model = await _context.Machines.FindAsync(viewModel.Id);
|
Machine model = await _context.Machines.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -110,10 +110,10 @@ namespace Marechai.Services
|
|||||||
if(news != null)
|
if(news != null)
|
||||||
await _context.News.AddAsync(news);
|
await _context.News.AddAsync(news);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(MachineViewModel viewModel)
|
public async Task<int> CreateAsync(MachineViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new Machine
|
var model = new Machine
|
||||||
{
|
{
|
||||||
@@ -122,7 +122,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.Machines.AddAsync(model);
|
await _context.Machines.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
var news = new News
|
var news = new News
|
||||||
{
|
{
|
||||||
@@ -148,7 +148,7 @@ namespace Marechai.Services
|
|||||||
if(news != null)
|
if(news != null)
|
||||||
{
|
{
|
||||||
await _context.News.AddAsync(news);
|
await _context.News.AddAsync(news);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
@@ -213,7 +213,7 @@ namespace Marechai.Services
|
|||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
Machine item = await _context.Machines.FindAsync(id);
|
Machine item = await _context.Machines.FindAsync(id);
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.Machines.Remove(item);
|
_context.Machines.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ namespace Marechai.Services
|
|||||||
Speed = m.Speed, MachineId = m.MachineId
|
Speed = m.Speed, MachineId = m.MachineId
|
||||||
}).OrderBy(m => m.Type).ThenBy(m => m.Usage).ThenBy(m => m.Size).ThenBy(m => m.Speed).ToListAsync();
|
}).OrderBy(m => m.Type).ThenBy(m => m.Usage).ThenBy(m => m.Size).ThenBy(m => m.Speed).ToListAsync();
|
||||||
|
|
||||||
public async Task DeleteAsync(long id)
|
public async Task DeleteAsync(long id, string userId)
|
||||||
{
|
{
|
||||||
MemoryByMachine item = await _context.MemoryByMachine.FindAsync(id);
|
MemoryByMachine item = await _context.MemoryByMachine.FindAsync(id);
|
||||||
|
|
||||||
@@ -55,11 +55,11 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.MemoryByMachine.Remove(item);
|
_context.MemoryByMachine.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<long> CreateAsync(int machineId, MemoryType type, MemoryUsage usage, long? size,
|
public async Task<long> CreateAsync(int machineId, MemoryType type, MemoryUsage usage, long? size,
|
||||||
double? speed)
|
double? speed, string userId)
|
||||||
{
|
{
|
||||||
var item = new MemoryByMachine
|
var item = new MemoryByMachine
|
||||||
{
|
{
|
||||||
@@ -68,7 +68,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.MemoryByMachine.AddAsync(item);
|
await _context.MemoryByMachine.AddAsync(item);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return item.Id;
|
return item.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,8 @@
|
|||||||
// Copyright © 2003-2020 Natalia Portillo
|
// Copyright © 2003-2020 Natalia Portillo
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Marechai.Database;
|
using Marechai.Database;
|
||||||
using Marechai.Database.Models;
|
using Marechai.Database.Models;
|
||||||
@@ -50,7 +48,8 @@ namespace Marechai.Services
|
|||||||
public async Task<List<NewsViewModel>> GetAsync() => await _context.News.OrderByDescending(n => n.Date).
|
public async Task<List<NewsViewModel>> GetAsync() => await _context.News.OrderByDescending(n => n.Date).
|
||||||
Select(n => new NewsViewModel
|
Select(n => new NewsViewModel
|
||||||
{
|
{
|
||||||
Id = n.Id, Timestamp = n.Date, Type = n.Type, AffectedId = n.AddedId
|
Id = n.Id, Timestamp = n.Date,
|
||||||
|
Type = n.Type, AffectedId = n.AddedId
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
public List<NewsViewModel> GetNews()
|
public List<NewsViewModel> GetNews()
|
||||||
@@ -124,7 +123,7 @@ namespace Marechai.Services
|
|||||||
return news;
|
return news;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
News item = await _context.News.FindAsync(id);
|
News item = await _context.News.FindAsync(id);
|
||||||
|
|
||||||
@@ -133,7 +132,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.News.Remove(item);
|
_context.News.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ namespace Marechai.Services
|
|||||||
Facebook = p.Facebook, Photo = p.Photo, Alias = p.Alias, DisplayName = p.DisplayName
|
Facebook = p.Facebook, Photo = p.Photo, Alias = p.Alias, DisplayName = p.DisplayName
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(PersonViewModel viewModel)
|
public async Task UpdateAsync(PersonViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
Person model = await _context.People.FindAsync(viewModel.Id);
|
Person model = await _context.People.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -75,10 +75,10 @@ namespace Marechai.Services
|
|||||||
model.Alias = viewModel.Alias;
|
model.Alias = viewModel.Alias;
|
||||||
model.DisplayName = viewModel.DisplayName;
|
model.DisplayName = viewModel.DisplayName;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(PersonViewModel viewModel)
|
public async Task<int> CreateAsync(PersonViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new Person
|
var model = new Person
|
||||||
{
|
{
|
||||||
@@ -89,12 +89,12 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.People.AddAsync(model);
|
await _context.People.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
Person item = await _context.People.FindAsync(id);
|
Person item = await _context.People.FindAsync(id);
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.People.Remove(item);
|
_context.People.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ namespace Marechai.Services
|
|||||||
ProcessorId = p.ProcessorId, MachineId = p.MachineId, Speed = p.Speed
|
ProcessorId = p.ProcessorId, MachineId = p.MachineId, Speed = p.Speed
|
||||||
}).OrderBy(p => p.CompanyName).ThenBy(p => p.Name).ToListAsync();
|
}).OrderBy(p => p.CompanyName).ThenBy(p => p.Name).ToListAsync();
|
||||||
|
|
||||||
public async Task DeleteAsync(long id)
|
public async Task DeleteAsync(long id, string userId)
|
||||||
{
|
{
|
||||||
ProcessorsByMachine item = await _context.ProcessorsByMachine.FindAsync(id);
|
ProcessorsByMachine item = await _context.ProcessorsByMachine.FindAsync(id);
|
||||||
|
|
||||||
@@ -55,10 +55,10 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.ProcessorsByMachine.Remove(item);
|
_context.ProcessorsByMachine.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<long> CreateAsync(int processorId, int machineId, float? speed)
|
public async Task<long> CreateAsync(int processorId, int machineId, float? speed, string userId)
|
||||||
{
|
{
|
||||||
var item = new ProcessorsByMachine
|
var item = new ProcessorsByMachine
|
||||||
{
|
{
|
||||||
@@ -66,7 +66,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.ProcessorsByMachine.AddAsync(item);
|
await _context.ProcessorsByMachine.AddAsync(item);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return item.Id;
|
return item.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace Marechai.Services
|
|||||||
L3 = p.L3, InstructionSet = p.InstructionSet.Name, InstructionSetId = p.InstructionSetId
|
L3 = p.L3, InstructionSet = p.InstructionSet.Name, InstructionSetId = p.InstructionSetId
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(ProcessorViewModel viewModel)
|
public async Task UpdateAsync(ProcessorViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
Processor model = await _context.Processors.FindAsync(viewModel.Id);
|
Processor model = await _context.Processors.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -113,10 +113,10 @@ namespace Marechai.Services
|
|||||||
model.ThreadsPerCore = viewModel.ThreadsPerCore;
|
model.ThreadsPerCore = viewModel.ThreadsPerCore;
|
||||||
model.Transistors = viewModel.Transistors;
|
model.Transistors = viewModel.Transistors;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(ProcessorViewModel viewModel)
|
public async Task<int> CreateAsync(ProcessorViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new Processor
|
var model = new Processor
|
||||||
{
|
{
|
||||||
@@ -132,12 +132,12 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.Processors.AddAsync(model);
|
await _context.Processors.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
Processor item = await _context.Processors.FindAsync(id);
|
Processor item = await _context.Processors.FindAsync(id);
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.Processors.Remove(item);
|
_context.Processors.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ namespace Marechai.Services
|
|||||||
ThenBy(r => r.Resolution.Colors).ThenBy(r => r.Resolution.Palette).
|
ThenBy(r => r.Resolution.Colors).ThenBy(r => r.Resolution.Palette).
|
||||||
ToList();
|
ToList();
|
||||||
|
|
||||||
public async Task DeleteAsync(long id)
|
public async Task DeleteAsync(long id, string userId)
|
||||||
{
|
{
|
||||||
ResolutionsByGpu item = await _context.ResolutionsByGpu.FindAsync(id);
|
ResolutionsByGpu item = await _context.ResolutionsByGpu.FindAsync(id);
|
||||||
|
|
||||||
@@ -63,10 +63,10 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.ResolutionsByGpu.Remove(item);
|
_context.ResolutionsByGpu.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<long> CreateAsync(int resolutionId, int gpuId)
|
public async Task<long> CreateAsync(int resolutionId, int gpuId, string userId)
|
||||||
{
|
{
|
||||||
var item = new ResolutionsByGpu
|
var item = new ResolutionsByGpu
|
||||||
{
|
{
|
||||||
@@ -74,7 +74,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.ResolutionsByGpu.AddAsync(item);
|
await _context.ResolutionsByGpu.AddAsync(item);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return item.Id;
|
return item.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace Marechai.Services
|
|||||||
ThenBy(r => r.Resolution.Colors).ThenBy(r => r.Resolution.Palette).
|
ThenBy(r => r.Resolution.Colors).ThenBy(r => r.Resolution.Palette).
|
||||||
ToList();
|
ToList();
|
||||||
|
|
||||||
public async Task DeleteAsync(long id)
|
public async Task DeleteAsync(long id, string userId)
|
||||||
{
|
{
|
||||||
ResolutionsByScreen item = await _context.ResolutionsByScreen.FindAsync(id);
|
ResolutionsByScreen item = await _context.ResolutionsByScreen.FindAsync(id);
|
||||||
|
|
||||||
@@ -63,10 +63,10 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.ResolutionsByScreen.Remove(item);
|
_context.ResolutionsByScreen.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<long> CreateAsync(int resolutionId, int screenId)
|
public async Task<long> CreateAsync(int resolutionId, int screenId, string userId)
|
||||||
{
|
{
|
||||||
var item = new ResolutionsByScreen
|
var item = new ResolutionsByScreen
|
||||||
{
|
{
|
||||||
@@ -74,7 +74,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.ResolutionsByScreen.AddAsync(item);
|
await _context.ResolutionsByScreen.AddAsync(item);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return item.Id;
|
return item.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Marechai.Services
|
|||||||
Palette = r.Palette, Chars = r.Chars, Grayscale = r.Grayscale
|
Palette = r.Palette, Chars = r.Chars, Grayscale = r.Grayscale
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(ResolutionViewModel viewModel)
|
public async Task UpdateAsync(ResolutionViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
Resolution model = await _context.Resolutions.FindAsync(viewModel.Id);
|
Resolution model = await _context.Resolutions.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -67,10 +67,10 @@ namespace Marechai.Services
|
|||||||
model.Palette = viewModel.Palette;
|
model.Palette = viewModel.Palette;
|
||||||
model.Width = viewModel.Width;
|
model.Width = viewModel.Width;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(ResolutionViewModel viewModel)
|
public async Task<int> CreateAsync(ResolutionViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new Resolution
|
var model = new Resolution
|
||||||
{
|
{
|
||||||
@@ -79,12 +79,12 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.Resolutions.AddAsync(model);
|
await _context.Resolutions.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
Resolution item = await _context.Resolutions.FindAsync(id);
|
Resolution item = await _context.Resolutions.FindAsync(id);
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.Resolutions.Remove(item);
|
_context.Resolutions.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ namespace Marechai.Services
|
|||||||
}
|
}
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
public async Task DeleteAsync(long id)
|
public async Task DeleteAsync(long id, string userId)
|
||||||
{
|
{
|
||||||
ScreensByMachine item = await _context.ScreensByMachine.FindAsync(id);
|
ScreensByMachine item = await _context.ScreensByMachine.FindAsync(id);
|
||||||
|
|
||||||
@@ -69,10 +69,10 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.ScreensByMachine.Remove(item);
|
_context.ScreensByMachine.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<long> CreateAsync(int machineId, int screenId)
|
public async Task<long> CreateAsync(int machineId, int screenId, string userId)
|
||||||
{
|
{
|
||||||
if(_context.ScreensByMachine.Any(s => s.MachineId == machineId && s.ScreenId == screenId))
|
if(_context.ScreensByMachine.Any(s => s.MachineId == machineId && s.ScreenId == screenId))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -83,7 +83,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.ScreensByMachine.AddAsync(item);
|
await _context.ScreensByMachine.AddAsync(item);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return item.Id;
|
return item.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace Marechai.Services
|
|||||||
NativeResolutionId = s.NativeResolutionId, Type = s.Type, Width = s.Width
|
NativeResolutionId = s.NativeResolutionId, Type = s.Type, Width = s.Width
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(ScreenViewModel viewModel)
|
public async Task UpdateAsync(ScreenViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
Screen model = await _context.Screens.FindAsync(viewModel.Id);
|
Screen model = await _context.Screens.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -94,10 +94,10 @@ namespace Marechai.Services
|
|||||||
model.Type = viewModel.Type;
|
model.Type = viewModel.Type;
|
||||||
model.Width = viewModel.Width;
|
model.Width = viewModel.Width;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(ScreenViewModel viewModel)
|
public async Task<int> CreateAsync(ScreenViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new Screen
|
var model = new Screen
|
||||||
{
|
{
|
||||||
@@ -106,12 +106,12 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.Screens.AddAsync(model);
|
await _context.Screens.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
Screen item = await _context.Screens.FindAsync(id);
|
Screen item = await _context.Screens.FindAsync(id);
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.Screens.Remove(item);
|
_context.Screens.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ namespace Marechai.Services
|
|||||||
SoundSynthId = g.SoundSynthId, MachineId = g.MachineId
|
SoundSynthId = g.SoundSynthId, MachineId = g.MachineId
|
||||||
}).OrderBy(g => g.CompanyName).ThenBy(g => g.Name).ToListAsync();
|
}).OrderBy(g => g.CompanyName).ThenBy(g => g.Name).ToListAsync();
|
||||||
|
|
||||||
public async Task DeleteAsync(long id)
|
public async Task DeleteAsync(long id, string userId)
|
||||||
{
|
{
|
||||||
SoundByMachine item = await _context.SoundByMachine.FindAsync(id);
|
SoundByMachine item = await _context.SoundByMachine.FindAsync(id);
|
||||||
|
|
||||||
@@ -55,10 +55,10 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.SoundByMachine.Remove(item);
|
_context.SoundByMachine.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<long> CreateAsync(int soundSynthId, int machineId)
|
public async Task<long> CreateAsync(int soundSynthId, int machineId, string userId)
|
||||||
{
|
{
|
||||||
var item = new SoundByMachine
|
var item = new SoundByMachine
|
||||||
{
|
{
|
||||||
@@ -66,7 +66,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.SoundByMachine.AddAsync(item);
|
await _context.SoundByMachine.AddAsync(item);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return item.Id;
|
return item.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace Marechai.Services
|
|||||||
Type = s.Type
|
Type = s.Type
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async Task UpdateAsync(SoundSynthViewModel viewModel)
|
public async Task UpdateAsync(SoundSynthViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
SoundSynth model = await _context.SoundSynths.FindAsync(viewModel.Id);
|
SoundSynth model = await _context.SoundSynths.FindAsync(viewModel.Id);
|
||||||
|
|
||||||
@@ -93,10 +93,10 @@ namespace Marechai.Services
|
|||||||
model.SquareWave = viewModel.SquareWave;
|
model.SquareWave = viewModel.SquareWave;
|
||||||
model.WhiteNoise = viewModel.WhiteNoise;
|
model.WhiteNoise = viewModel.WhiteNoise;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> CreateAsync(SoundSynthViewModel viewModel)
|
public async Task<int> CreateAsync(SoundSynthViewModel viewModel, string userId)
|
||||||
{
|
{
|
||||||
var model = new SoundSynth
|
var model = new SoundSynth
|
||||||
{
|
{
|
||||||
@@ -107,12 +107,12 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.SoundSynths.AddAsync(model);
|
await _context.SoundSynths.AddAsync(model);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id, string userId)
|
||||||
{
|
{
|
||||||
SoundSynth item = await _context.SoundSynths.FindAsync(id);
|
SoundSynth item = await _context.SoundSynths.FindAsync(id);
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.SoundSynths.Remove(item);
|
_context.SoundSynths.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ namespace Marechai.Services
|
|||||||
MachineId = s.MachineId
|
MachineId = s.MachineId
|
||||||
}).OrderBy(s => s.Type).ThenBy(s => s.Interface).ThenBy(s => s.Capacity).ToListAsync();
|
}).OrderBy(s => s.Type).ThenBy(s => s.Interface).ThenBy(s => s.Capacity).ToListAsync();
|
||||||
|
|
||||||
public async Task DeleteAsync(long id)
|
public async Task DeleteAsync(long id, string userId)
|
||||||
{
|
{
|
||||||
StorageByMachine item = await _context.StorageByMachine.FindAsync(id);
|
StorageByMachine item = await _context.StorageByMachine.FindAsync(id);
|
||||||
|
|
||||||
@@ -56,11 +56,11 @@ namespace Marechai.Services
|
|||||||
|
|
||||||
_context.StorageByMachine.Remove(item);
|
_context.StorageByMachine.Remove(item);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<long> CreateAsync(int machineId, StorageType type, StorageInterface @interface,
|
public async Task<long> CreateAsync(int machineId, StorageType type, StorageInterface @interface,
|
||||||
long? capacity)
|
long? capacity, string userId)
|
||||||
{
|
{
|
||||||
var item = new StorageByMachine
|
var item = new StorageByMachine
|
||||||
{
|
{
|
||||||
@@ -68,7 +68,7 @@ namespace Marechai.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _context.StorageByMachine.AddAsync(item);
|
await _context.StorageByMachine.AddAsync(item);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesWithUserAsync(userId);
|
||||||
|
|
||||||
return item.Id;
|
return item.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user