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 System.ComponentModel;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace Cicm.Database.Models
|
namespace Cicm.Database.Models
|
||||||
{
|
{
|
||||||
public class ResolutionsByGpu : BaseModel<long>
|
public class ResolutionsByGpu : BaseModel<long>
|
||||||
{
|
{
|
||||||
|
[Remote("VerifyUnique", "ResolutionsByGpu", "Admin", AdditionalFields = nameof(ResolutionId))]
|
||||||
public int GpuId { get; set; }
|
public int GpuId { get; set; }
|
||||||
|
[Remote("VerifyUnique", "ResolutionsByGpu", "Admin", AdditionalFields = nameof(GpuId))]
|
||||||
public int ResolutionId { get; set; }
|
public int ResolutionId { get; set; }
|
||||||
|
|
||||||
[DisplayName("GPU")]
|
[DisplayName("GPU")]
|
||||||
|
|||||||
@@ -169,5 +169,14 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
{
|
{
|
||||||
return _context.ResolutionsByGpu.Any(e => e.Id == id);
|
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"
|
class="form-control"
|
||||||
asp-items="ViewBag.GpuId">
|
asp-items="ViewBag.GpuId">
|
||||||
</select>
|
</select>
|
||||||
|
<span asp-validation-for="GpuId"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Resolution"
|
<label asp-for="Resolution"
|
||||||
@@ -31,6 +34,9 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
asp-items="ViewBag.ResolutionId">
|
asp-items="ViewBag.ResolutionId">
|
||||||
</select>
|
</select>
|
||||||
|
<span asp-validation-for="ResolutionId"
|
||||||
|
class="text-danger">
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input class="btn btn-primary"
|
<input class="btn btn-primary"
|
||||||
|
|||||||
@@ -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.503</Version>
|
<Version>3.0.99.504</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