mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add resolutions by GPU validation.
This commit is contained in:
@@ -29,12 +29,15 @@
|
||||
*******************************************************************************/
|
||||
|
||||
using System.ComponentModel;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Cicm.Database.Models
|
||||
{
|
||||
public class ResolutionsByGpu : BaseModel<long>
|
||||
{
|
||||
public int GpuId { get; set; }
|
||||
[Remote("VerifyUnique", "ResolutionsByGpu", "Admin", AdditionalFields = nameof(ResolutionId))]
|
||||
public int GpuId { get; set; }
|
||||
[Remote("VerifyUnique", "ResolutionsByGpu", "Admin", AdditionalFields = nameof(GpuId))]
|
||||
public int ResolutionId { get; set; }
|
||||
|
||||
[DisplayName("GPU")]
|
||||
|
||||
@@ -169,5 +169,14 @@ namespace cicm_web.Areas.Admin.Controllers
|
||||
{
|
||||
return _context.ResolutionsByGpu.Any(e => e.Id == id);
|
||||
}
|
||||
|
||||
[AcceptVerbs("Get", "Post")]
|
||||
public async Task<IActionResult> VerifyUnique(int gpuId, int resolutionId)
|
||||
{
|
||||
return await _context.ResolutionsByGpu.FirstOrDefaultAsync(i => i.GpuId == gpuId &&
|
||||
i.ResolutionId == resolutionId) is null
|
||||
? Json(true)
|
||||
: Json("The selected GPU already has the selected resolution.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,9 @@
|
||||
class="form-control"
|
||||
asp-items="ViewBag.GpuId">
|
||||
</select>
|
||||
<span asp-validation-for="GpuId"
|
||||
class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Resolution"
|
||||
@@ -31,6 +34,9 @@
|
||||
class="form-control"
|
||||
asp-items="ViewBag.ResolutionId">
|
||||
</select>
|
||||
<span asp-validation-for="ResolutionId"
|
||||
class="text-danger">
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="btn btn-primary"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>3.0.99.503</Version>
|
||||
<Version>3.0.99.504</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
Reference in New Issue
Block a user