mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Set display modes for companies admin.
This commit is contained in:
@@ -30,6 +30,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Cicm.Database.Models
|
namespace Cicm.Database.Models
|
||||||
@@ -47,9 +50,10 @@ namespace Cicm.Database.Models
|
|||||||
SoundSynths = new HashSet<SoundSynth>();
|
SoundSynths = new HashSet<SoundSynth>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public DateTime? Founded { get; set; }
|
[DisplayFormat(DataFormatString = "{0:d}")]
|
||||||
|
public DateTime? Founded { get; set; }
|
||||||
public string Website { get; set; }
|
public string Website { get; set; }
|
||||||
public string Twitter { get; set; }
|
public string Twitter { get; set; }
|
||||||
public string Facebook { get; set; }
|
public string Facebook { get; set; }
|
||||||
@@ -62,8 +66,9 @@ namespace Cicm.Database.Models
|
|||||||
public short? CountryId { get; set; }
|
public short? CountryId { get; set; }
|
||||||
public CompanyStatus Status { get; set; }
|
public CompanyStatus Status { get; set; }
|
||||||
|
|
||||||
public virtual Iso31661Numeric Country { get; set; }
|
public virtual Iso31661Numeric Country { get; set; }
|
||||||
public virtual Company SoldTo { get; set; }
|
[DisplayName("Sold to")]
|
||||||
|
public virtual Company SoldTo { get; set; }
|
||||||
public virtual CompanyDescription Description { get; set; }
|
public virtual CompanyDescription Description { get; set; }
|
||||||
public virtual ICollection<CompanyLogo> Logos { get; set; }
|
public virtual ICollection<CompanyLogo> Logos { get; set; }
|
||||||
public virtual ICollection<Gpu> Gpus { get; set; }
|
public virtual ICollection<Gpu> Gpus { get; set; }
|
||||||
@@ -74,5 +79,18 @@ namespace Cicm.Database.Models
|
|||||||
public virtual ICollection<SoundSynth> SoundSynths { get; set; }
|
public virtual ICollection<SoundSynth> SoundSynths { get; set; }
|
||||||
public virtual CompanyLogo LastLogo =>
|
public virtual CompanyLogo LastLogo =>
|
||||||
Logos?.OrderByDescending(l => l.Year).FirstOrDefault();
|
Logos?.OrderByDescending(l => l.Year).FirstOrDefault();
|
||||||
|
|
||||||
|
[DisplayName("Sold")]
|
||||||
|
[NotMapped]
|
||||||
|
public string SoldView =>
|
||||||
|
Status != CompanyStatus.Active && Status != CompanyStatus.Unknown
|
||||||
|
? Sold is null
|
||||||
|
? "Unknown"
|
||||||
|
: Sold.Value.ToShortDateString()
|
||||||
|
: Sold is null
|
||||||
|
? SoldToId is null
|
||||||
|
? ""
|
||||||
|
: "Unknown"
|
||||||
|
: Sold.Value.ToShortDateString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
{
|
{
|
||||||
IIncludableQueryable<Company, Company> cicmContext =
|
IIncludableQueryable<Company, Company> cicmContext =
|
||||||
_context.Companies.Include(c => c.Country).Include(c => c.SoldTo);
|
_context.Companies.Include(c => c.Country).Include(c => c.SoldTo);
|
||||||
return View(await cicmContext.ToListAsync());
|
return View(await cicmContext.OrderBy(c => c.Name).ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Admin/Companies/Details/5
|
// GET: Admin/Companies/Details/5
|
||||||
|
|||||||
@@ -36,12 +36,15 @@
|
|||||||
ViewData["Title"] = "Index";
|
ViewData["Title"] = "Index";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h2>Index</h2>
|
<h2>Companies</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="Create">Create New</a>
|
<a asp-action="Create"
|
||||||
|
class="btn btn-primary">
|
||||||
|
Create New
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
@@ -57,7 +60,7 @@
|
|||||||
@Html.DisplayNameFor(model => model.Country)
|
@Html.DisplayNameFor(model => model.Country)
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.Sold)
|
@Html.DisplayNameFor(model => model.SoldView)
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.SoldTo)
|
@Html.DisplayNameFor(model => model.SoldTo)
|
||||||
@@ -82,7 +85,7 @@
|
|||||||
@Html.DisplayFor(modelItem => item.Country.Name)
|
@Html.DisplayFor(modelItem => item.Country.Name)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Sold)
|
@Html.DisplayFor(modelItem => item.SoldView)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.SoldTo.Name)
|
@Html.DisplayFor(modelItem => item.SoldTo.Name)
|
||||||
|
|||||||
@@ -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.388</Version>
|
<Version>3.0.99.392</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