Sort sound synthetizers in admin page.

This commit is contained in:
2019-05-19 02:05:06 +01:00
parent 530869f2e0
commit 7f4e733524
7 changed files with 107 additions and 109 deletions

View File

@@ -30,6 +30,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace Cicm.Database.Models namespace Cicm.Database.Models
{ {
@@ -40,19 +42,28 @@ namespace Cicm.Database.Models
SoundByMachine = new HashSet<SoundByMachine>(); SoundByMachine = new HashSet<SoundByMachine>();
} }
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public int? CompanyId { get; set; } public int? CompanyId { get; set; }
public string ModelCode { get; set; } [DisplayName("Model code")]
public string ModelCode { get; set; }
public DateTime? Introduced { get; set; } public DateTime? Introduced { get; set; }
public int? Voices { get; set; } [DisplayName("PCM voices")]
public double? Frequency { get; set; } public int? Voices { get; set; }
public int? Depth { get; set; } [DisplayName("Sample rate (Hz)")]
public int? SquareWave { get; set; } public double? Frequency { get; set; }
public int? WhiteNoise { get; set; } [DisplayName("Sample resolution")]
public int? Type { get; set; } public int? Depth { get; set; }
[DisplayName("Square wave channels")]
public int? SquareWave { get; set; }
[DisplayName("White noise channels")]
public int? WhiteNoise { get; set; }
public int? Type { get; set; }
public virtual Company Company { get; set; } public virtual Company Company { get; set; }
public virtual ICollection<SoundByMachine> SoundByMachine { get; set; } public virtual ICollection<SoundByMachine> SoundByMachine { get; set; }
[NotMapped]
public string IntroducedView => Introduced?.ToShortDateString() ?? "Unknown";
} }
} }

View File

@@ -46,7 +46,7 @@
class="text-danger"> class="text-danger">
</div> </div>
<div class="form-group"> <div class="form-group">
<label asp-for="CompanyId" <label asp-for="Company"
class="control-label"> class="control-label">
</label> </label>
<select asp-for="CompanyId" <select asp-for="CompanyId"
@@ -54,6 +54,16 @@
asp-items="ViewBag.CompanyId"> asp-items="ViewBag.CompanyId">
</select> </select>
</div> </div>
<div class="form-group">
<label asp-for="Name"
class="control-label">
</label>
<input asp-for="Name"
class="form-control" />
<span asp-validation-for="Name"
class="text-danger">
</span>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="ModelCode" <label asp-for="ModelCode"
class="control-label"> class="control-label">
@@ -74,6 +84,16 @@
class="text-danger"> class="text-danger">
</span> </span>
</div> </div>
<div class="form-group">
<label asp-for="Type"
class="control-label">
</label>
<input asp-for="Type"
class="form-control" />
<span asp-validation-for="Type"
class="text-danger">
</span>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="Voices" <label asp-for="Voices"
class="control-label"> class="control-label">
@@ -124,16 +144,6 @@
class="text-danger"> class="text-danger">
</span> </span>
</div> </div>
<div class="form-group">
<label asp-for="Type"
class="control-label">
</label>
<input asp-for="Type"
class="form-control" />
<span asp-validation-for="Type"
class="text-danger">
</span>
</div>
<div class="form-group"> <div class="form-group">
<input class="btn btn-primary" <input class="btn btn-primary"
type="submit" type="submit"

View File

@@ -42,6 +42,12 @@
<h4>Sound synthetizer</h4> <h4>Sound synthetizer</h4>
<hr /> <hr />
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Company)
</dt>
<dd>
@Html.DisplayFor(model => model.Company.Name)
</dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.Name) @Html.DisplayNameFor(model => model.Name)
</dt> </dt>
@@ -58,7 +64,13 @@
@Html.DisplayNameFor(model => model.Introduced) @Html.DisplayNameFor(model => model.Introduced)
</dt> </dt>
<dd> <dd>
@Html.DisplayFor(model => model.Introduced) @Html.DisplayFor(model => model.IntroducedView)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Type)
</dt>
<dd>
@Html.DisplayFor(model => model.Type)
</dd> </dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.Voices) @Html.DisplayNameFor(model => model.Voices)
@@ -90,18 +102,6 @@
<dd> <dd>
@Html.DisplayFor(model => model.WhiteNoise) @Html.DisplayFor(model => model.WhiteNoise)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.Type)
</dt>
<dd>
@Html.DisplayFor(model => model.Type)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Company)
</dt>
<dd>
@Html.DisplayFor(model => model.Company.Name)
</dd>
</dl> </dl>
<form asp-action="Delete"> <form asp-action="Delete">

View File

@@ -41,6 +41,12 @@
<h4>Sound synthetizer</h4> <h4>Sound synthetizer</h4>
<hr /> <hr />
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Company)
</dt>
<dd>
@Html.DisplayFor(model => model.Company.Name)
</dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.Name) @Html.DisplayNameFor(model => model.Name)
</dt> </dt>
@@ -57,7 +63,13 @@
@Html.DisplayNameFor(model => model.Introduced) @Html.DisplayNameFor(model => model.Introduced)
</dt> </dt>
<dd> <dd>
@Html.DisplayFor(model => model.Introduced) @Html.DisplayFor(model => model.IntroducedView)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Type)
</dt>
<dd>
@Html.DisplayFor(model => model.Type)
</dd> </dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.Voices) @Html.DisplayNameFor(model => model.Voices)
@@ -89,21 +101,16 @@
<dd> <dd>
@Html.DisplayFor(model => model.WhiteNoise) @Html.DisplayFor(model => model.WhiteNoise)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.Type)
</dt>
<dd>
@Html.DisplayFor(model => model.Type)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Company)
</dt>
<dd>
@Html.DisplayFor(model => model.Company.Name)
</dd>
</dl> </dl>
</div> </div>
<div> <div>
<a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-primary">Edit</a> <a asp-action="Edit"
<a asp-action="Index" class="btn btn-secondary">Back to List</a> asp-route-id="@Model.Id"
</div> class="btn btn-primary">
Edit
</a>
<a asp-action="Index"
class="btn btn-secondary">
Back to List
</a>
</div>

View File

@@ -48,17 +48,7 @@
<input type="hidden" <input type="hidden"
asp-for="Id" /> asp-for="Id" />
<div class="form-group"> <div class="form-group">
<label asp-for="Name" <label asp-for="Company"
class="control-label">
</label>
<input asp-for="Name"
class="form-control" />
<span asp-validation-for="Name"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="CompanyId"
class="control-label"> class="control-label">
</label> </label>
<select asp-for="CompanyId" <select asp-for="CompanyId"
@@ -69,6 +59,16 @@
class="text-danger"> class="text-danger">
</span> </span>
</div> </div>
<div class="form-group">
<label asp-for="Name"
class="control-label">
</label>
<input asp-for="Name"
class="form-control" />
<span asp-validation-for="Name"
class="text-danger">
</span>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="ModelCode" <label asp-for="ModelCode"
class="control-label"> class="control-label">
@@ -89,6 +89,16 @@
class="text-danger"> class="text-danger">
</span> </span>
</div> </div>
<div class="form-group">
<label asp-for="Type"
class="control-label">
</label>
<input asp-for="Type"
class="form-control" />
<span asp-validation-for="Type"
class="text-danger">
</span>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="Voices" <label asp-for="Voices"
class="control-label"> class="control-label">
@@ -139,16 +149,6 @@
class="text-danger"> class="text-danger">
</span> </span>
</div> </div>
<div class="form-group">
<label asp-for="Type"
class="control-label">
</label>
<input asp-for="Type"
class="form-control" />
<span asp-validation-for="Type"
class="text-danger">
</span>
</div>
<div class="form-group"> <div class="form-group">
<input class="btn btn-primary" <input class="btn btn-primary"
type="submit" type="submit"

View File

@@ -47,6 +47,9 @@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>
@Html.DisplayNameFor(model => model.Company)
</th>
<th> <th>
@Html.DisplayNameFor(model => model.Name) @Html.DisplayNameFor(model => model.Name)
</th> </th>
@@ -56,27 +59,9 @@
<th> <th>
@Html.DisplayNameFor(model => model.Introduced) @Html.DisplayNameFor(model => model.Introduced)
</th> </th>
<th>
@Html.DisplayNameFor(model => model.Voices)
</th>
<th>
@Html.DisplayNameFor(model => model.Frequency)
</th>
<th>
@Html.DisplayNameFor(model => model.Depth)
</th>
<th>
@Html.DisplayNameFor(model => model.SquareWave)
</th>
<th>
@Html.DisplayNameFor(model => model.WhiteNoise)
</th>
<th> <th>
@Html.DisplayNameFor(model => model.Type) @Html.DisplayNameFor(model => model.Type)
</th> </th>
<th>
@Html.DisplayNameFor(model => model.Company)
</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@@ -84,6 +69,9 @@
@foreach(SoundSynth item in Model) @foreach(SoundSynth item in Model)
{ {
<tr> <tr>
<td>
@Html.DisplayFor(modelItem => item.Company.Name)
</td>
<td> <td>
@Html.DisplayFor(modelItem => item.Name) @Html.DisplayFor(modelItem => item.Name)
</td> </td>
@@ -91,29 +79,11 @@
@Html.DisplayFor(modelItem => item.ModelCode) @Html.DisplayFor(modelItem => item.ModelCode)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.Introduced) @Html.DisplayFor(modelItem => item.IntroducedView)
</td>
<td>
@Html.DisplayFor(modelItem => item.Voices)
</td>
<td>
@Html.DisplayFor(modelItem => item.Frequency)
</td>
<td>
@Html.DisplayFor(modelItem => item.Depth)
</td>
<td>
@Html.DisplayFor(modelItem => item.SquareWave)
</td>
<td>
@Html.DisplayFor(modelItem => item.WhiteNoise)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.Type) @Html.DisplayFor(modelItem => item.Type)
</td> </td>
<td>
@Html.DisplayFor(modelItem => item.Company.Name)
</td>
<td> <td>
<a asp-action="Details" <a asp-action="Details"
asp-route-id="@item.Id" asp-route-id="@item.Id"

View File

@@ -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.450</Version> <Version>3.0.99.451</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>