Optimize view of company admin page.

This commit is contained in:
2019-05-19 23:32:06 +01:00
parent 416a5de374
commit 60cdf6f98b
4 changed files with 66 additions and 13 deletions

View File

@@ -0,0 +1,37 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Cicm.Database;
namespace cicm_web.Areas.Admin.Models
{
public class CompanyViewModel
{
public int Id { get; set; }
public string Name { get; set; }
[DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
[DataType(DataType.Date)]
public DateTime? Founded { get; set; }
[DisplayFormat(DataFormatString = "{0:d}")]
[DataType(DataType.Date)]
public DateTime? Sold { get; set; }
public string SoldTo { get; set; }
public string Country { get; set; }
[Required]
public CompanyStatus Status { get; set; }
[DisplayName("Sold")]
[NotMapped]
public string SoldView =>
Status != CompanyStatus.Active && Status != CompanyStatus.Unknown
? Sold is null
? "Unknown"
: Sold.Value.ToShortDateString()
: Sold is null
? SoldTo is null
? ""
: "Unknown"
: Sold.Value.ToShortDateString();
}
}