mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add instruction set extension by processor validation.
This commit is contained in:
@@ -28,11 +28,15 @@
|
|||||||
// Copyright © 2003-2018 Natalia Portillo
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace Cicm.Database.Models
|
namespace Cicm.Database.Models
|
||||||
{
|
{
|
||||||
public class InstructionSetExtensionsByProcessor : BaseModel<int>
|
public class InstructionSetExtensionsByProcessor : BaseModel<int>
|
||||||
{
|
{
|
||||||
|
[Remote("VerifyUnique", "InstructionSetExtensionsByProcessor", "Admin", AdditionalFields = nameof(ExtensionId))]
|
||||||
public int ProcessorId { get; set; }
|
public int ProcessorId { get; set; }
|
||||||
|
[Remote("VerifyUnique", "InstructionSetExtensionsByProcessor", "Admin", AdditionalFields = nameof(ProcessorId))]
|
||||||
public int ExtensionId { get; set; }
|
public int ExtensionId { get; set; }
|
||||||
|
|
||||||
public virtual InstructionSetExtension Extension { get; set; }
|
public virtual InstructionSetExtension Extension { get; set; }
|
||||||
|
|||||||
@@ -156,5 +156,18 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
{
|
{
|
||||||
return _context.InstructionSetExtensionsByProcessor.Any(e => e.Id == id);
|
return _context.InstructionSetExtensionsByProcessor.Any(e => e.Id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AcceptVerbs("Get", "Post")]
|
||||||
|
public async Task<IActionResult> VerifyUnique(int processorId, int extensionId)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
await _context.InstructionSetExtensionsByProcessor.FirstOrDefaultAsync(i =>
|
||||||
|
i.ProcessorId ==
|
||||||
|
processorId &&
|
||||||
|
i.ExtensionId == extensionId)
|
||||||
|
is null
|
||||||
|
? Json(true)
|
||||||
|
: Json("The selected processor already has the selected extension.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,9 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
asp-items="ViewBag.ProcessorId">
|
asp-items="ViewBag.ProcessorId">
|
||||||
</select>
|
</select>
|
||||||
|
<span asp-validation-for="ProcessorId"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Extension"
|
<label asp-for="Extension"
|
||||||
@@ -31,6 +34,9 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
asp-items="ViewBag.ExtensionId">
|
asp-items="ViewBag.ExtensionId">
|
||||||
</select>
|
</select>
|
||||||
|
<span asp-validation-for="ExtensionId"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input class="btn btn-primary"
|
<input class="btn btn-primary"
|
||||||
@@ -43,4 +49,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@section Scripts {
|
||||||
|
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||||
|
}
|
||||||
@@ -51,4 +51,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@section Scripts {
|
||||||
|
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||||
<Version>3.0.99.497</Version>
|
<Version>3.0.99.503</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
|
|||||||
Reference in New Issue
Block a user