Optimize view of machines admin page.

This commit is contained in:
2019-05-19 23:51:16 +01:00
parent 7d21265ecd
commit d1cbec9eef
4 changed files with 45 additions and 8 deletions

View File

@@ -0,0 +1,27 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Cicm.Database;
namespace cicm_web.Areas.Admin.Models
{
public class MachineViewModel
{
public int Id { get; set; }
[StringLength(255)]
public string Name { get; set; }
public MachineType Type { get; set; }
[DisplayFormat(DataFormatString = "{0:d}")]
[DataType(DataType.Date)]
public DateTime? Introduced { get; set; }
public string Family { get; set; }
[StringLength(50)]
public string Model { get; set; }
public string Company { get; set; }
[DisplayName("Introduced")]
public string IntroducedView =>
Introduced == DateTime.MinValue ? "Prototype" : Introduced?.ToShortDateString() ?? "Unknown";
}
}