mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add GPU editing in admin view.
This commit is contained in:
@@ -1,122 +0,0 @@
|
||||
@{
|
||||
/******************************************************************************
|
||||
// MARECHAI: Master repository of computing history artifacts information
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : Edit.cshtml
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Admin view edit
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright © 2003-2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
}
|
||||
@model Marechai.Database.Models.Gpu
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Edit";
|
||||
}
|
||||
<h2>Edit</h2>
|
||||
<h4>GPU</h4>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Edit">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger">
|
||||
</div>
|
||||
<input type="hidden" asp-for="Id" />
|
||||
<div class="form-group">
|
||||
<label asp-for="Company" class="control-label">
|
||||
</label>
|
||||
<select asp-for="CompanyId" class="form-control" asp-items="ViewBag.CompanyId">
|
||||
</select>
|
||||
<span asp-validation-for="CompanyId" class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Name" class="control-label">
|
||||
</label>
|
||||
<input asp-for="Name" class="form-control" />
|
||||
<span asp-validation-for="Name" class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="ModelCode" class="control-label">
|
||||
</label>
|
||||
<input asp-for="ModelCode" class="form-control" />
|
||||
<span asp-validation-for="ModelCode" class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Introduced" class="control-label">
|
||||
</label>
|
||||
<input asp-for="Introduced" class="form-control" />
|
||||
<span asp-validation-for="Introduced" class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Package" class="control-label">
|
||||
</label>
|
||||
<input asp-for="Package" class="form-control" />
|
||||
<span asp-validation-for="Package" class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Process" class="control-label">
|
||||
</label>
|
||||
<input asp-for="Process" class="form-control" />
|
||||
<span asp-validation-for="Process" class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="ProcessNm" class="control-label">
|
||||
</label>
|
||||
<input asp-for="ProcessNm" class="form-control" />
|
||||
<span asp-validation-for="ProcessNm" class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="DieSize" class="control-label">
|
||||
</label>
|
||||
<input asp-for="DieSize" class="form-control" />
|
||||
<span asp-validation-for="DieSize" class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Transistors" class="control-label">
|
||||
</label>
|
||||
<input asp-for="Transistors" class="form-control" />
|
||||
<span asp-validation-for="Transistors" class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="btn btn-primary" type="submit" value="Save" />
|
||||
<a asp-action="Index" class="btn btn-secondary">
|
||||
Back to List
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<Version>3.0.99.1229</Version>
|
||||
<Version>3.0.99.1230</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
@@ -31,9 +31,11 @@
|
||||
}
|
||||
|
||||
@page "/admin/gpus/details/{Id:int}"
|
||||
@page "/admin/gpus/edit/{Id:int}"
|
||||
@inherits OwningComponentBase<GpusService>
|
||||
@inject IStringLocalizer<GpusService> L
|
||||
@inject CompaniesService CompaniesService
|
||||
@inject NavigationManager NavigationManager
|
||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||
<h3>@L["Graphical processing unit details"]</h3>
|
||||
<hr />
|
||||
@@ -46,76 +48,194 @@
|
||||
}
|
||||
|
||||
<div>
|
||||
@if (_editable || _model.CompanyId != null)
|
||||
@if (_editing || _model.CompanyId != null)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Company"]</FieldLabel>
|
||||
<Select Disabled="!_editable" TValue="int?" @bind-SelectedValue="@_model.CompanyId">
|
||||
@foreach (var company in _companies)
|
||||
{
|
||||
<SelectItem TValue="int?" Value="@company.Id">@company.Name</SelectItem>
|
||||
}
|
||||
</Select>
|
||||
@if (_editing)
|
||||
{
|
||||
<Check TValue="bool" @bind-Checked="@_unknownCompany">@L["Unknown (company)"]</Check>
|
||||
}
|
||||
@if (!_editing ||
|
||||
!_unknownCompany)
|
||||
{
|
||||
<Select Disabled="!_editing" TValue="int?" @bind-SelectedValue="@_model.CompanyId">
|
||||
@foreach (var company in _companies)
|
||||
{
|
||||
<SelectItem TValue="int?" Value="@company.Id">@company.Name</SelectItem>
|
||||
}
|
||||
</Select>
|
||||
}
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.Name != null)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Name"]</FieldLabel>
|
||||
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Name" />
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.ModelCode != null)
|
||||
<Field>
|
||||
<FieldLabel>@L["Name"]</FieldLabel>
|
||||
<Validation Validator="@ValidateName">
|
||||
<TextEdit Disabled="!_editing" @bind-Text="@_model.Name">
|
||||
<Feedback>
|
||||
<ValidationError>@L["Please enter a valid name."]</ValidationError>
|
||||
</Feedback>
|
||||
</TextEdit>
|
||||
</Validation>
|
||||
</Field>
|
||||
@if (_editing || _model.ModelCode != null)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Model code"]</FieldLabel>
|
||||
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.ModelCode" />
|
||||
@if (_editing)
|
||||
{
|
||||
<Check TValue="bool" @bind-Checked="@_unknownModelCode">@L["Unknown (model code)"]</Check>
|
||||
}
|
||||
@if (!_editing ||
|
||||
!_unknownModelCode)
|
||||
{
|
||||
<Validation Validator="@ValidateModelCode">
|
||||
<TextEdit Disabled="!_editing" @bind-Text="@_model.ModelCode">
|
||||
<Feedback>
|
||||
<ValidationError>@L["Please enter a valid model code."]</ValidationError>
|
||||
</Feedback>
|
||||
</TextEdit>
|
||||
</Validation>
|
||||
}
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.Introduced != null)
|
||||
@if (_editing || _model.Introduced.HasValue)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Introduced"]</FieldLabel>
|
||||
<DateEdit TValue="DateTime?" ReadOnly="!_editable" @bind-Date="@_model.Introduced" />
|
||||
</Field>
|
||||
@if (_editing)
|
||||
{
|
||||
<Check TValue="bool" Disabled="_prototype" @bind-Checked="@_unknownIntroduced">@L["Unknown (introduction date)"]</Check>
|
||||
<Check TValue="bool" Disabled="_unknownIntroduced" @bind-Checked="@_prototype">@L["Prototype"]</Check>
|
||||
}
|
||||
@if (!_editing ||
|
||||
(!_prototype && !_unknownIntroduced))
|
||||
{
|
||||
<Validation Validator="@ValidateIntroduced">
|
||||
<DateEdit Disabled="!_editing" TValue="DateTime?" @bind-Date="@_model.Introduced">
|
||||
<Feedback>
|
||||
<ValidationError>@L["Please enter an introduction date."]</ValidationError>
|
||||
</Feedback>
|
||||
</DateEdit>
|
||||
</Validation>
|
||||
}
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.Package != null)
|
||||
@if (_editing || _model.Package != null)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Package"]</FieldLabel>
|
||||
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Package" />
|
||||
@if (_editing)
|
||||
{
|
||||
<Check TValue="bool" @bind-Checked="@_unknownPackage">@L["Unknown (package)"]</Check>
|
||||
}
|
||||
@if (!_editing ||
|
||||
!_unknownPackage)
|
||||
{
|
||||
<Validation Validator="@ValidatePackage">
|
||||
<TextEdit ReadOnly="!_editing" @bind-Text="@_model.Package">
|
||||
<Feedback>
|
||||
<ValidationError>@L["Please enter a valid package."]</ValidationError>
|
||||
</Feedback>
|
||||
</TextEdit>
|
||||
</Validation>
|
||||
}
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.Process != null)
|
||||
@if (_editing || _model.Process != null)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Process"]</FieldLabel>
|
||||
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Process" />
|
||||
@if (_editing)
|
||||
{
|
||||
<Check TValue="bool" @bind-Checked="@_unknownProcess">@L["Unknown (process)"]</Check>
|
||||
}
|
||||
@if (!_editing ||
|
||||
!_unknownProcess)
|
||||
{
|
||||
<Validation Validator="@ValidateProcess">
|
||||
<TextEdit ReadOnly="!_editing" @bind-Text="@_model.Process">
|
||||
<Feedback>
|
||||
<ValidationError>@L["Please enter a valid process."]</ValidationError>
|
||||
</Feedback>
|
||||
</TextEdit>
|
||||
</Validation>
|
||||
}
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.ProcessNm != null)
|
||||
@if (_editing || _model.ProcessNm.HasValue)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Process (nm)"]</FieldLabel>
|
||||
<NumericEdit TValue="float?" Decimals="2" ReadOnly="!_editable" @bind-Text="@_model.ProcessNm" />
|
||||
@if (_editing)
|
||||
{
|
||||
<Check TValue="bool" @bind-Checked="@_unknownProcessNm">@L["Unknown (process size)"]</Check>
|
||||
}
|
||||
@if (!_editing ||
|
||||
!_unknownProcessNm)
|
||||
{
|
||||
<Validation Validator="@ValidateFloatBiggerThanOne">
|
||||
<NumericEdit Disabled="!_editing" TValue="float?" Decimals="2" @bind-Value="@_model.ProcessNm">
|
||||
<Feedback>
|
||||
<ValidationError>@L["Please enter a valid process size in nanometers."]</ValidationError>
|
||||
</Feedback>
|
||||
</NumericEdit>
|
||||
</Validation>
|
||||
}
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.DieSize != null)
|
||||
@if (_editing || _model.DieSize.HasValue)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Die size (mm²)"]</FieldLabel>
|
||||
<NumericEdit TValue="float?" Decimals="2" ReadOnly="!_editable" @bind-Text="@_model.DieSize" />
|
||||
@if (_editing)
|
||||
{
|
||||
<Check TValue="bool" @bind-Checked="@_unknownDieSize">@L["Unknown (die size)"]</Check>
|
||||
}
|
||||
@if (!_editing ||
|
||||
!_unknownDieSize)
|
||||
{
|
||||
<Validation Validator="@ValidateFloatBiggerThanOne">
|
||||
<NumericEdit Disabled="!_editing" TValue="float?" Decimals="2" @bind-Value="@_model.DieSize">
|
||||
<Feedback>
|
||||
<ValidationError>@L["Please enter a valid die size in square millimeters."]</ValidationError>
|
||||
</Feedback>
|
||||
</NumericEdit>
|
||||
</Validation>
|
||||
}
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.Transistors != null)
|
||||
@if (_editing || _model.Transistors.HasValue)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Transistors"]</FieldLabel>
|
||||
<NumericEdit TValue="long?" Decimals="0" ReadOnly="!_editable" @bind-Text="@_model.Transistors" />
|
||||
@if (_editing)
|
||||
{
|
||||
<Check TValue="bool" @bind-Checked="@_unknownTransistors">@L["Unknown (transistors)"]</Check>
|
||||
}
|
||||
@if (!_editing ||
|
||||
!_unknownTransistors)
|
||||
{
|
||||
<Validation Validator="@ValidateLongBiggerThanZero">
|
||||
<NumericEdit Disabled="!_editing" TValue="long?" Decimals="0" @bind-Value="@_model.Transistors">
|
||||
<Feedback>
|
||||
<ValidationError>@L["Please enter a valid number of transistors."]</ValidationError>
|
||||
</Feedback>
|
||||
</NumericEdit>
|
||||
</Validation>
|
||||
}
|
||||
</Field>
|
||||
}
|
||||
</div>
|
||||
<div>
|
||||
<span class="btn btn-primary">@L["Edit"]</span>
|
||||
<a href="/admin/companies" class="btn btn-secondary">@L["Back to list"]</a>
|
||||
@if (!_editing)
|
||||
{
|
||||
<Button Color="Color.Primary" Clicked="@OnEditClicked">@L["Edit"]</Button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Button Color="Color.Success" Clicked="@OnSaveClicked">@L["Save"]</Button>
|
||||
<Button Color="Color.Danger" Clicked="@OnCancelClicked">@L["Cancel"]</Button>
|
||||
}
|
||||
<a href="/admin/gpus" class="btn btn-secondary">@L["Back to list"]</a>
|
||||
</div>
|
||||
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Blazorise;
|
||||
using Marechai.Shared;
|
||||
using Marechai.ViewModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
@@ -8,9 +11,18 @@ namespace Marechai.Pages.Admin.Details
|
||||
public partial class Gpu
|
||||
{
|
||||
List<CompanyViewModel> _companies;
|
||||
bool _editable;
|
||||
bool _editing;
|
||||
bool _loaded;
|
||||
Database.Models.Gpu _model;
|
||||
GpuViewModel _model;
|
||||
bool _prototype;
|
||||
bool _unknownCompany;
|
||||
bool _unknownDieSize;
|
||||
bool _unknownIntroduced;
|
||||
bool _unknownModelCode;
|
||||
bool _unknownPackage;
|
||||
bool _unknownProcess;
|
||||
bool _unknownProcessNm;
|
||||
bool _unknownTransistors;
|
||||
[Parameter]
|
||||
public int Id { get; set; }
|
||||
|
||||
@@ -27,7 +39,110 @@ namespace Marechai.Pages.Admin.Details
|
||||
_companies = await CompaniesService.GetAsync();
|
||||
_model = await Service.GetAsync(Id);
|
||||
|
||||
_editing = NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
|
||||
StartsWith("admin/gpus/edit/", StringComparison.InvariantCulture);
|
||||
|
||||
if(_editing)
|
||||
SetCheckboxes();
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
void SetCheckboxes()
|
||||
{
|
||||
_unknownCompany = !_model.CompanyId.HasValue;
|
||||
_unknownDieSize = !_model.DieSize.HasValue;
|
||||
_unknownIntroduced = !_model.Introduced.HasValue;
|
||||
_unknownModelCode = string.IsNullOrWhiteSpace(_model.ModelCode);
|
||||
_unknownPackage = string.IsNullOrWhiteSpace(_model.Package);
|
||||
_unknownProcess = string.IsNullOrWhiteSpace(_model.Process);
|
||||
_unknownProcessNm = !_model.ProcessNm.HasValue;
|
||||
_unknownTransistors = !_model.Transistors.HasValue;
|
||||
_prototype = _model.Introduced?.Year == 1000;
|
||||
}
|
||||
|
||||
void OnEditClicked()
|
||||
{
|
||||
_editing = true;
|
||||
SetCheckboxes();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
async void OnCancelClicked()
|
||||
{
|
||||
_editing = false;
|
||||
_model = await Service.GetAsync(Id);
|
||||
SetCheckboxes();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
async void OnSaveClicked()
|
||||
{
|
||||
if(_unknownCompany)
|
||||
_model.CompanyId = null;
|
||||
else if(_model.CompanyId < 0)
|
||||
return;
|
||||
|
||||
if(_unknownModelCode)
|
||||
_model.ModelCode = null;
|
||||
else if(string.IsNullOrWhiteSpace(_model.ModelCode))
|
||||
return;
|
||||
|
||||
if(_unknownIntroduced)
|
||||
_model.Introduced = null;
|
||||
else if(_prototype)
|
||||
_model.Introduced = new DateTime(1000, 1, 1);
|
||||
else if(_model.Introduced >= DateTime.UtcNow.Date)
|
||||
return;
|
||||
|
||||
if(_unknownPackage)
|
||||
_model.Package = null;
|
||||
else if(string.IsNullOrWhiteSpace(_model.Package))
|
||||
return;
|
||||
|
||||
if(_unknownProcess)
|
||||
_model.Process = null;
|
||||
else if(string.IsNullOrWhiteSpace(_model.Process))
|
||||
return;
|
||||
|
||||
if(_unknownProcessNm)
|
||||
_model.ProcessNm = null;
|
||||
else if(_model.ProcessNm < 1)
|
||||
return;
|
||||
|
||||
if(_unknownDieSize)
|
||||
_model.DieSize = null;
|
||||
else if(_model.DieSize < 1)
|
||||
return;
|
||||
|
||||
if(_unknownTransistors)
|
||||
_model.Transistors = null;
|
||||
else if(_model.Transistors < 0)
|
||||
return;
|
||||
|
||||
_editing = false;
|
||||
await Service.UpdateAsync(_model);
|
||||
_model = await Service.GetAsync(Id);
|
||||
SetCheckboxes();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
void ValidateName(ValidatorEventArgs e) =>
|
||||
Validators.ValidateString(e, L["Name must be 50 characters or less."], 50);
|
||||
|
||||
void ValidateModelCode(ValidatorEventArgs e) =>
|
||||
Validators.ValidateString(e, L["Model code must be 45 characters or less."], 45);
|
||||
|
||||
void ValidateIntroduced(ValidatorEventArgs e) => Validators.ValidateIntroducedDate(e);
|
||||
|
||||
void ValidatePackage(ValidatorEventArgs e) =>
|
||||
Validators.ValidateString(e, L["Package must be 45 characters or less."], 45);
|
||||
|
||||
void ValidateLongBiggerThanZero(ValidatorEventArgs e) => Validators.ValidateLong(e);
|
||||
|
||||
void ValidateFloatBiggerThanOne(ValidatorEventArgs e) => Validators.ValidateFloat(e, 1);
|
||||
|
||||
void ValidateProcess(ValidatorEventArgs e) =>
|
||||
Validators.ValidateString(e, L["Process must be 45 characters or less."], 45);
|
||||
}
|
||||
}
|
||||
@@ -82,9 +82,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-primary" href="/admin/gpus/details/@item.Id">@L["Details"]</a>
|
||||
<span class="btn btn-secondary">
|
||||
@L["Edit"]
|
||||
</span>
|
||||
<a class="btn btn-primary" href="/admin/gpus/edit/@item.Id">@L["Edit"]</a>
|
||||
<Button Color="Color.Danger" Clicked="() => {ShowModal(item.Id);}">@L["Delete"]</Button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
153
Marechai/Resources/Services/GpusService.en.resx
Normal file
153
Marechai/Resources/Services/GpusService.en.resx
Normal file
@@ -0,0 +1,153 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- ReSharper disable MarkupTextTypo -->
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Unknown (company)" xml:space="preserve">
|
||||
<value>Unknown</value>
|
||||
<comment>Unknown, referring to a company</comment>
|
||||
</data>
|
||||
<data name="Unknown (model code)" xml:space="preserve">
|
||||
<value>Unknown</value>
|
||||
<comment>Unknown, referring to a model code</comment>
|
||||
</data>
|
||||
<data name="Unknown (introduction date)" xml:space="preserve">
|
||||
<value>Unknown</value>
|
||||
<comment>Unknown, referring to an introduction date</comment>
|
||||
</data>
|
||||
<data name="Unknown (package)" xml:space="preserve">
|
||||
<value>Unknown</value>
|
||||
<comment>Unknown, referring to a chip package</comment>
|
||||
</data>
|
||||
<data name="Unknown (process)" xml:space="preserve">
|
||||
<value>Unknown</value>
|
||||
<comment>Unknown, referring to the chip process</comment>
|
||||
</data>
|
||||
<data name="Unknown (process size)" xml:space="preserve">
|
||||
<value>Unknown</value>
|
||||
<comment>Unknown, referring to the chip process size in nanometers</comment>
|
||||
</data>
|
||||
<data name="Unknown (die size)" xml:space="preserve">
|
||||
<value>Unknown</value>
|
||||
<comment>Unknown, referring to the die size in square millimeters</comment>
|
||||
</data>
|
||||
<data name="Unknown (transistors)" xml:space="preserve">
|
||||
<value>Unknown</value>
|
||||
<comment>Unknown, referring to the number of transistors</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -198,4 +198,76 @@
|
||||
<value>Transistores</value>
|
||||
<comment>Transistors</comment>
|
||||
</data>
|
||||
<data name="Save" xml:space="preserve">
|
||||
<value>Guardar</value>
|
||||
<comment>Save</comment>
|
||||
</data>
|
||||
<data name="Unknown (company)" xml:space="preserve">
|
||||
<value>Desconocida</value>
|
||||
<comment>Unknown, referring to a company</comment>
|
||||
</data>
|
||||
<data name="Unknown (model code)" xml:space="preserve">
|
||||
<value>Desconocido</value>
|
||||
<comment>Unknown, referring to a model code</comment>
|
||||
</data>
|
||||
<data name="Unknown (introduction date)" xml:space="preserve">
|
||||
<value>Desconocida</value>
|
||||
<comment>Unknown, referring to an introduction date</comment>
|
||||
</data>
|
||||
<data name="Unknown (package)" xml:space="preserve">
|
||||
<value>Desconocido</value>
|
||||
<comment>Unknown, referring to a chip package</comment>
|
||||
</data>
|
||||
<data name="Unknown (process)" xml:space="preserve">
|
||||
<value>Desconocido</value>
|
||||
<comment>Unknown, referring to the chip process</comment>
|
||||
</data>
|
||||
<data name="Unknown (process size)" xml:space="preserve">
|
||||
<value>Desconocido</value>
|
||||
<comment>Unknown, referring to the chip process size in nanometers</comment>
|
||||
</data>
|
||||
<data name="Unknown (die size)" xml:space="preserve">
|
||||
<value>Desconocida</value>
|
||||
<comment>Unknown, referring to the die size in square millimeters</comment>
|
||||
</data>
|
||||
<data name="Unknown (transistors)" xml:space="preserve">
|
||||
<value>Desconocidos</value>
|
||||
<comment>Unknown, referring to the number of transistors</comment>
|
||||
</data>
|
||||
<data name="Please enter a valid name." xml:space="preserve">
|
||||
<value>Por favor introduce un nombre válido.</value>
|
||||
<comment>Please enter a valid name.</comment>
|
||||
</data>
|
||||
<data name="Please enter a valid model code." xml:space="preserve">
|
||||
<value>Por favor introduce un modelo válido.</value>
|
||||
<comment>Please enter a valid model code.</comment>
|
||||
</data>
|
||||
<data name="Prototype" xml:space="preserve">
|
||||
<value>Prototipo</value>
|
||||
<comment>Prototype</comment>
|
||||
</data>
|
||||
<data name="Please enter an introduction date." xml:space="preserve">
|
||||
<value>Por favor elige una fecha válida.</value>
|
||||
<comment>Please enter an introduction date.</comment>
|
||||
</data>
|
||||
<data name="Please enter a valid package." xml:space="preserve">
|
||||
<value>Por favor introduce un empaquetado válido.</value>
|
||||
<comment>Please enter a valid package.</comment>
|
||||
</data>
|
||||
<data name="Please enter a valid process." xml:space="preserve">
|
||||
<value>Por favor introduce un proceso válido.</value>
|
||||
<comment>Please enter a valid process.</comment>
|
||||
</data>
|
||||
<data name="Please enter a valid process size in nanometers." xml:space="preserve">
|
||||
<value>Por favor introduce un tamaño de proceso en nanómetros válido.</value>
|
||||
<comment>Please enter a valid process size in nanometers.</comment>
|
||||
</data>
|
||||
<data name="Please enter a valid die size in square millimeters." xml:space="preserve">
|
||||
<value>Por favor introduce un área del chip en milímetros cuadrados válida.</value>
|
||||
<comment>Please enter a valid die size in square millimeters.</comment>
|
||||
</data>
|
||||
<data name="Please enter a valid number of transistors." xml:space="preserve">
|
||||
<value>Por favor introduce un número válido de transistores.</value>
|
||||
<comment>Please enter a valid number of transistors.</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -31,7 +31,33 @@ namespace Marechai.Services
|
||||
Transistors = g.Transistors
|
||||
}).ToListAsync();
|
||||
|
||||
public async Task<Gpu> GetAsync(int id) => await _context.Gpus.FindAsync(id);
|
||||
public async Task<GpuViewModel> GetAsync(int id) =>
|
||||
await _context.Gpus.Where(g => g.Id == id).Select(g => new GpuViewModel
|
||||
{
|
||||
Id = g.Id, Name = g.Name, CompanyId = g.Company.Id, ModelCode = g.ModelCode,
|
||||
Introduced = g.Introduced, Package = g.Package, Process = g.Process, ProcessNm = g.ProcessNm,
|
||||
DieSize = g.DieSize, Transistors = g.Transistors
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
public async Task UpdateAsync(GpuViewModel viewModel)
|
||||
{
|
||||
Gpu model = await _context.Gpus.FindAsync(viewModel.Id);
|
||||
|
||||
if(model is null)
|
||||
return;
|
||||
|
||||
model.Name = viewModel.Name;
|
||||
model.CompanyId = viewModel.CompanyId;
|
||||
model.ModelCode = viewModel.ModelCode;
|
||||
model.Introduced = viewModel.Introduced;
|
||||
model.Package = viewModel.Package;
|
||||
model.Process = viewModel.Process;
|
||||
model.ProcessNm = viewModel.ProcessNm;
|
||||
model.DieSize = viewModel.DieSize;
|
||||
model.Transistors = viewModel.Transistors;
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(int id)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user