Implement page for listing screens.

This commit is contained in:
2019-06-01 23:48:54 +01:00
parent 2022dc0080
commit 366e27917c
6 changed files with 44 additions and 26 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -7,14 +8,18 @@ namespace Cicm.Database.Models
public class Screen : BaseModel<int>
{
[Range(1, 131072)]
[DisplayName("Width (mm)")]
public double? Width { get; set; }
[Range(1, 131072)]
[DisplayName("Height (mm)")]
public double? Height { get; set; }
[Required]
[DisplayName("Diagonal (inches)")]
public double Diagonal { get; set; }
[Required]
public virtual Resolution NativeResolution { get; set; }
[Range(2, 281474976710656)]
[DisplayName("Effective colors")]
public long? EffectiveColors { get; set; }
[Required]
public string Type { get; set; }
@@ -22,6 +27,17 @@ namespace Cicm.Database.Models
[NotMapped]
public long? Colors => EffectiveColors ?? NativeResolution.Colors;
[NotMapped]
public string Size
{
get
{
if(Width != null && Height != null) return $"{Width}x{Height} mm";
return "Unknown";
}
}
public virtual ICollection<ResolutionsByScreen> Resolutions { get; set; }
public virtual ICollection<ScreensByMachine> ScreensByMachines { get; set; }
}