From 349a941392cc253b0490ccbffe46c0e0e165ff82 Mon Sep 17 00:00:00 2001
From: Natalia Portillo
Date: Sat, 28 Apr 2018 21:29:01 +0100
Subject: [PATCH] Update DB to version 21: Have full introduction date for
machines, not only year.
---
Cicm.Database/Operations/Init.cs | 60 +++++------
Cicm.Database/Operations/Machine.cs | 20 ++--
Cicm.Database/Operations/Operations.cs | 2 +-
Cicm.Database/Operations/Update.cs | 75 +++++++++++++
Cicm.Database/Schemas/Machine.cs | 6 +-
Cicm.Database/Schemas/Sql/V21.cs | 120 +++++++++++++++++++++
cicm_web/Controllers/ComputerController.cs | 4 +-
cicm_web/Controllers/ConsoleController.cs | 4 +-
cicm_web/Models/Computer.cs | 2 +-
cicm_web/Models/Console.cs | 2 +-
cicm_web/Models/Machine.cs | 6 +-
cicm_web/Views/Machine/View.cshtml | 10 +-
cicm_web/cicm_web.csproj | 2 +-
13 files changed, 256 insertions(+), 57 deletions(-)
create mode 100644 Cicm.Database/Schemas/Sql/V21.cs
diff --git a/Cicm.Database/Operations/Init.cs b/Cicm.Database/Operations/Init.cs
index 368b247c..7f2dadc8 100644
--- a/Cicm.Database/Operations/Init.cs
+++ b/Cicm.Database/Operations/Init.cs
@@ -49,123 +49,123 @@ namespace Cicm.Database
IDbCommand dbCmd = dbCon.CreateCommand();
Console.WriteLine("Creating table `admins`");
- dbCmd.CommandText = V20.Admins;
+ dbCmd.CommandText = V21.Admins;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `browser_tests`");
- dbCmd.CommandText = V20.BrowserTests;
+ dbCmd.CommandText = V21.BrowserTests;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `cicm_db`");
- dbCmd.CommandText = V20.CicmDb;
+ dbCmd.CommandText = V21.CicmDb;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `companies`");
- dbCmd.CommandText = V20.Companies;
+ dbCmd.CommandText = V21.Companies;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `machines`");
- dbCmd.CommandText = V20.Machines;
+ dbCmd.CommandText = V21.Machines;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `forbidden`");
- dbCmd.CommandText = V20.Forbidden;
+ dbCmd.CommandText = V21.Forbidden;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `gpus`");
- dbCmd.CommandText = V20.Gpus;
+ dbCmd.CommandText = V21.Gpus;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `log`");
- dbCmd.CommandText = V20.Logs;
+ dbCmd.CommandText = V21.Logs;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `money_donations`");
- dbCmd.CommandText = V20.MoneyDonations;
+ dbCmd.CommandText = V21.MoneyDonations;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `news`");
- dbCmd.CommandText = V20.News;
+ dbCmd.CommandText = V21.News;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `owned_computers`");
- dbCmd.CommandText = V20.OwnedComputers;
+ dbCmd.CommandText = V21.OwnedComputers;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `owned_consoles`");
- dbCmd.CommandText = V20.OwnedConsoles;
+ dbCmd.CommandText = V21.OwnedConsoles;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `instruction_sets`");
- dbCmd.CommandText = V20.InstructionSets;
+ dbCmd.CommandText = V21.InstructionSets;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `instruction_set_extensions`");
- dbCmd.CommandText = V20.InstructionSetExtensions;
+ dbCmd.CommandText = V21.InstructionSetExtensions;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `processors`");
- dbCmd.CommandText = V20.Processors;
+ dbCmd.CommandText = V21.Processors;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `instruction_set_extensions_by_processor`");
- dbCmd.CommandText = V20.InstructionSetExtensionsByProcessor;
+ dbCmd.CommandText = V21.InstructionSetExtensionsByProcessor;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `sound_synths`");
- dbCmd.CommandText = V20.SoundSynths;
+ dbCmd.CommandText = V21.SoundSynths;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `iso3166_1_numeric`");
- dbCmd.CommandText = V20.Iso3166Numeric;
+ dbCmd.CommandText = V21.Iso3166Numeric;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Filling table `iso3166_1_numeric`");
- dbCmd.CommandText = V20.Iso3166NumericValues;
+ dbCmd.CommandText = V21.Iso3166NumericValues;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating foreign keys for table `companies`");
- dbCmd.CommandText = V20.CompaniesForeignKeys;
+ dbCmd.CommandText = V21.CompaniesForeignKeys;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating foreign keys for table `machines`");
- dbCmd.CommandText = V20.MachinesForeignKeys;
+ dbCmd.CommandText = V21.MachinesForeignKeys;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `company_logos`");
- dbCmd.CommandText = V20.CompanyLogos;
+ dbCmd.CommandText = V21.CompanyLogos;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `company_descriptions`");
- dbCmd.CommandText = V20.CompanyDescriptions;
+ dbCmd.CommandText = V21.CompanyDescriptions;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `processors_by_machine`");
- dbCmd.CommandText = V20.ProcessorsByMachine;
+ dbCmd.CommandText = V21.ProcessorsByMachine;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `gpus_by_machine`");
- dbCmd.CommandText = V20.GpusByMachine;
+ dbCmd.CommandText = V21.GpusByMachine;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `sound_by_machine`");
- dbCmd.CommandText = V20.SoundByMachine;
+ dbCmd.CommandText = V21.SoundByMachine;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `memory_by_machine`");
- dbCmd.CommandText = V20.MemoryByMachine;
+ dbCmd.CommandText = V21.MemoryByMachine;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `resolutions`");
- dbCmd.CommandText = V20.Resolutions;
+ dbCmd.CommandText = V21.Resolutions;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `resolutions_by_gpu`");
- dbCmd.CommandText = V20.ResolutionsByGpu;
+ dbCmd.CommandText = V21.ResolutionsByGpu;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating table `storage_by_machine`");
- dbCmd.CommandText = V20.StorageByMachine;
+ dbCmd.CommandText = V21.StorageByMachine;
dbCmd.ExecuteNonQuery();
return true;
diff --git a/Cicm.Database/Operations/Machine.cs b/Cicm.Database/Operations/Machine.cs
index 7f835954..595a8620 100644
--- a/Cicm.Database/Operations/Machine.cs
+++ b/Cicm.Database/Operations/Machine.cs
@@ -214,7 +214,7 @@ namespace Cicm.Database
dbcmd.Transaction = trans;
const string SQL =
- "INSERT INTO machines (company, year, model, type) VALUES (@company, @year, @model, @type)";
+ "INSERT INTO machines (company, introduced, model, type) VALUES (@company, @introduced, @model, @type)";
dbcmd.CommandText = SQL;
@@ -246,8 +246,9 @@ namespace Cicm.Database
IDbTransaction trans = dbCon.BeginTransaction();
dbcmd.Transaction = trans;
- string sql = "UPDATE machines SET company = @company, year = @year, model = @model, type = @type " +
- $"WHERE id = {entry.Id}";
+ string sql =
+ "UPDATE machines SET company = @company, introduced = @introduced, model = @model, type = @type " +
+ $"WHERE id = {entry.Id}";
dbcmd.CommandText = sql;
@@ -294,17 +295,17 @@ namespace Cicm.Database
IDbDataParameter param4 = dbcmd.CreateParameter();
param1.ParameterName = "@company";
- param2.ParameterName = "@year";
+ param2.ParameterName = "@introduced";
param3.ParameterName = "@model";
param4.ParameterName = "@type";
param1.DbType = DbType.Int32;
- param2.DbType = DbType.Int32;
+ param2.DbType = DbType.DateTime;
param3.DbType = DbType.String;
param4.DbType = DbType.Int32;
param1.Value = entry.Company;
- param2.Value = entry.Year;
+ param2.Value = entry.Introduced;
param3.Value = entry.Model;
param4.Value = entry.Type;
@@ -326,9 +327,10 @@ namespace Cicm.Database
{
Id = (int)dataRow["id"],
Company = (int)dataRow["company"],
- Year = (int)dataRow["year"],
- Model = (string)dataRow["model"],
- Type = (MachineType)dataRow["type"]
+ Introduced =
+ dataRow["introduced"] == DBNull.Value ? DateTime.MinValue : (DateTime)dataRow["introduced"],
+ Model = (string)dataRow["model"],
+ Type = (MachineType)dataRow["type"]
};
entries.Add(entry);
diff --git a/Cicm.Database/Operations/Operations.cs b/Cicm.Database/Operations/Operations.cs
index 6f62502c..fbe065da 100644
--- a/Cicm.Database/Operations/Operations.cs
+++ b/Cicm.Database/Operations/Operations.cs
@@ -35,7 +35,7 @@ namespace Cicm.Database
public partial class Operations
{
/// Last known database version
- const int DB_VERSION = 20;
+ const int DB_VERSION = 21;
/// The column with this value indicates there is no item of this type.
public const int DB_NONE = -1;
///
diff --git a/Cicm.Database/Operations/Update.cs b/Cicm.Database/Operations/Update.cs
index 3b744854..7536fda4 100644
--- a/Cicm.Database/Operations/Update.cs
+++ b/Cicm.Database/Operations/Update.cs
@@ -169,6 +169,11 @@ namespace Cicm.Database
UpdateDatabaseToV20();
break;
}
+ case 20:
+ {
+ UpdateDatabaseToV21();
+ break;
+ }
}
OptimizeDatabase();
@@ -2411,6 +2416,76 @@ namespace Cicm.Database
dbCmd.Dispose();
}
+ void UpdateDatabaseToV21()
+ {
+ Console.WriteLine("Updating database to version 21");
+
+ Console.WriteLine("Adding new columns to table `machines`");
+ IDbCommand dbCmd = dbCon.CreateCommand();
+ IDbTransaction trans = dbCon.BeginTransaction();
+ dbCmd.Transaction = trans;
+ dbCmd.CommandText = "ALTER TABLE `machines` ADD COLUMN `introduced` DATETIME NULL;\n" +
+ "CREATE INDEX idx_machines_introduced ON machines (introduced);";
+ dbCmd.ExecuteNonQuery();
+ trans.Commit();
+ dbCmd.Dispose();
+
+ Console.WriteLine("Getting all items from `machines`");
+
+ dbCmd = dbCon.CreateCommand();
+ IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
+ dbCmd.CommandText = "SELECT * from machines";
+ DataSet dataSet = new DataSet();
+ dataAdapter.SelectCommand = dbCmd;
+ dataAdapter.Fill(dataSet);
+
+ foreach(DataRow dataRow in dataSet.Tables[0].Rows)
+ {
+ IDbCommand dbcmd = dbCon.CreateCommand();
+
+ IDbDataParameter param1 = dbcmd.CreateParameter();
+
+ param1.ParameterName = "@introduced";
+
+ param1.DbType = DbType.DateTime;
+
+ if((int)dataRow["year"] > 0) param1.Value = new DateTime((int)dataRow["year"], 1, 1);
+ else param1.Value = null;
+
+ string sql = $"UPDATE `machines` SET introduced = @introduced WHERE id = {(int)dataRow["id"]}";
+
+ dbcmd.Parameters.Add(param1);
+
+ trans = dbCon.BeginTransaction();
+ dbcmd.Transaction = trans;
+
+ Console.WriteLine("Adding introduction date {0} to machine {1}", (int)dataRow["year"],
+ (int)dataRow["id"]);
+
+ dbcmd.CommandText = sql;
+
+ dbcmd.ExecuteNonQuery();
+ trans.Commit();
+
+ dbcmd.Dispose();
+ }
+
+ Console.WriteLine("Removing year column from table `machines`");
+ dbCmd = dbCon.CreateCommand();
+ trans = dbCon.BeginTransaction();
+ dbCmd.Transaction = trans;
+ dbCmd.CommandText = "ALTER TABLE `machines` DROP COLUMN `year`;";
+ dbCmd.ExecuteNonQuery();
+ trans.Commit();
+ dbCmd.Dispose();
+
+ Console.WriteLine("Setting new database version to 21...");
+ dbCmd = dbCon.CreateCommand();
+ dbCmd.CommandText = "INSERT INTO cicm_db (version) VALUES ('21')";
+ dbCmd.ExecuteNonQuery();
+ dbCmd.Dispose();
+ }
+
void OptimizeDatabase()
{
IDbCommand dbCmd = dbCon.CreateCommand();
diff --git a/Cicm.Database/Schemas/Machine.cs b/Cicm.Database/Schemas/Machine.cs
index dde08e87..0eca8ef5 100644
--- a/Cicm.Database/Schemas/Machine.cs
+++ b/Cicm.Database/Schemas/Machine.cs
@@ -28,6 +28,8 @@
// Copyright © 2003-2018 Natalia Portillo
*******************************************************************************/
+using System;
+
namespace Cicm.Database.Schemas
{
/// Computer
@@ -37,11 +39,11 @@ namespace Cicm.Database.Schemas
public int Company;
/// ID
public int Id;
+ /// Introduction date, null if unknown, 1000 if prototype
+ public DateTime Introduced;
/// Model name
public string Model;
/// Machine type
public MachineType Type;
- /// Introduction date, 0 if unknown, 1000 if prototype
- public int Year;
}
}
\ No newline at end of file
diff --git a/Cicm.Database/Schemas/Sql/V21.cs b/Cicm.Database/Schemas/Sql/V21.cs
new file mode 100644
index 00000000..a2392aa8
--- /dev/null
+++ b/Cicm.Database/Schemas/Sql/V21.cs
@@ -0,0 +1,120 @@
+/******************************************************************************
+// Canary Islands Computer Museum Website
+// ----------------------------------------------------------------------------
+//
+// Filename : V21.cs
+// Author(s) : Natalia Portillo
+//
+// --[ Description ] ----------------------------------------------------------
+//
+// Contains SQL queries to create the database version 7.
+//
+// --[ License ] --------------------------------------------------------------
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// ----------------------------------------------------------------------------
+// Copyright © 2003-2018 Natalia Portillo
+*******************************************************************************/
+
+namespace Cicm.Database.Schemas.Sql
+{
+ public static class V21
+ {
+ public static readonly string Admins = V20.Admins;
+
+ public static readonly string BrowserTests = V20.BrowserTests;
+
+ public static readonly string CicmDb = "CREATE TABLE `cicm_db` (\n" +
+ "`id` int(11) NOT NULL AUTO_INCREMENT,\n" +
+ "`version` int(11) NOT NULL,\n" +
+ "`updated` datetime DEFAULT CURRENT_TIMESTAMP,\n" +
+ "PRIMARY KEY (`id`));\n" +
+ "INSERT INTO cicm_db (version) VALUES ('20');";
+
+ public static readonly string Companies = V20.Companies;
+
+ public static readonly string Machines = "CREATE TABLE `machines` (;\n" +
+ "`id` int(11) NOT NULL AUTO_INCREMENT,;\n" +
+ "`company` int(11) NOT NULL DEFAULT '0',;\n" +
+ "`introduced` DATETIME NULL,;\n" +
+ "`model` char(50) NOT NULL DEFAULT '',;\n" +
+ "`type` int(11) NOT NULL DEFAULT '0',;\n" +
+ "PRIMARY KEY (`id`),;\n" +
+ "KEY `idx_machines_company` (`company`),;\n" +
+ "KEY `idx_machines_introduced` (`introduced`),;\n" +
+ "KEY `idx_machines_model` (`model`),;\n" +
+ "KEY `idx_machines_type` (`type`));";
+
+ public static readonly string Forbidden = V20.Forbidden;
+
+ public static readonly string Gpus = V20.Gpus;
+
+ public static readonly string Logs = V20.Logs;
+
+ public static readonly string MoneyDonations = V20.MoneyDonations;
+
+ public static readonly string News = V20.News;
+
+ public static readonly string OwnedComputers = V20.OwnedComputers;
+
+ public static readonly string OwnedConsoles = V20.OwnedConsoles;
+
+ public static readonly string Processors = V20.Processors;
+
+ public static readonly string SoundSynths = V20.SoundSynths;
+
+ public static readonly string MachinesForeignKeys =
+ "ALTER TABLE `machines` ADD FOREIGN KEY `fk_machines_company` (company) REFERENCES `companies` (`id`) ON UPDATE CASCADE;";
+
+ public static readonly string Iso3166Numeric = V20.Iso3166Numeric;
+
+ public static readonly string Iso3166NumericValues = V20.Iso3166NumericValues;
+
+ public static readonly string CompaniesForeignKeys = V20.CompaniesForeignKeys;
+
+ public static readonly string CompanyLogos = V20.CompanyLogos;
+
+ public static readonly string CompanyDescriptions = V20.CompanyDescriptions;
+
+ public static readonly string InstructionSets = V20.InstructionSets;
+
+ public static readonly string InstructionSetExtensions = V20.InstructionSetExtensions;
+
+ public static readonly string InstructionSetExtensionsByProcessor = V20.InstructionSetExtensionsByProcessor;
+
+ public static readonly string ProcessorsByMachine = V20.ProcessorsByMachine;
+
+ public static readonly string GpusByMachine = V20.GpusByMachine;
+
+ public static readonly string SoundByMachine = V20.SoundByMachine;
+
+ public static readonly string MemoryByMachine = V20.MemoryByMachine;
+
+ public static readonly string Resolutions = V20.Resolutions;
+
+ public static readonly string ResolutionsByGpu = V20.ResolutionsByGpu;
+
+ public static readonly string StorageByMachine = "CREATE TABLE `storage_by_machine` (\n" +
+ "`machine` INT NOT NULL,\n" +
+ "`type` INT NOT NULL DEFAULT 0,\n" +
+ "`interface` INT NOT NULL DEFAULT 0,\n" +
+ "`capacity` BIGINT DEFAULT NULL,\n" +
+ "KEY `idx_storage_machine` (`machine`),\n" +
+ "KEY `idx_storage_type` (`type`),\n" +
+ "KEY `idx_storage_interface` (`interface`),\n" +
+ "KEY `idx_storage_capacity` (`capacity`),\n" +
+ "CONSTRAINT `fk_storage_by_machine_machine` FOREIGN KEY (`machine`) REFERENCES `machines` (`id`) ON UPDATE CASCADE ON DELETE CASCADE);";
+ }
+}
\ No newline at end of file
diff --git a/cicm_web/Controllers/ComputerController.cs b/cicm_web/Controllers/ComputerController.cs
index 72556d8a..218f7ad0 100644
--- a/cicm_web/Controllers/ComputerController.cs
+++ b/cicm_web/Controllers/ComputerController.cs
@@ -52,8 +52,8 @@ namespace cicm_web.Controllers
ViewBag.ItemCount = computers.Count;
- ViewBag.MinYear = computers.Where(t => t.Year > 1000).Min(t => t.Year);
- ViewBag.MaxYear = computers.Where(t => t.Year > 1000).Max(t => t.Year);
+ ViewBag.MinYear = computers.Where(t => t.Introduced.Year > 1000).Min(t => t.Introduced.Year);
+ ViewBag.MaxYear = computers.Where(t => t.Introduced.Year > 1000).Max(t => t.Introduced.Year);
return View();
}
diff --git a/cicm_web/Controllers/ConsoleController.cs b/cicm_web/Controllers/ConsoleController.cs
index d9efd180..6af7f12c 100644
--- a/cicm_web/Controllers/ConsoleController.cs
+++ b/cicm_web/Controllers/ConsoleController.cs
@@ -52,8 +52,8 @@ namespace cicm_web.Controllers
ViewBag.ItemCount = consoles.Count;
- ViewBag.MinYear = consoles.Where(t => t.Year > 1000).Min(t => t.Year);
- ViewBag.MaxYear = consoles.Where(t => t.Year > 1000).Max(t => t.Year);
+ ViewBag.MinYear = consoles.Where(t => t.Introduced.Year > 1000).Min(t => t.Introduced.Year);
+ ViewBag.MaxYear = consoles.Where(t => t.Introduced.Year > 1000).Max(t => t.Introduced.Year);
return View();
}
diff --git a/cicm_web/Models/Computer.cs b/cicm_web/Models/Computer.cs
index cff8a5b4..c0e8f007 100644
--- a/cicm_web/Models/Computer.cs
+++ b/cicm_web/Models/Computer.cs
@@ -101,7 +101,7 @@ namespace cicm_web.Models
List items = new List();
foreach(Cicm.Database.Schemas.Machine dbItem in dbItems)
- if(dbItem.Year == year)
+ if(dbItem.Introduced.Year == year)
items.Add(MachineMini.TransformItem(dbItem));
return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Model).ToArray();
diff --git a/cicm_web/Models/Console.cs b/cicm_web/Models/Console.cs
index 73974bb8..f9518c20 100644
--- a/cicm_web/Models/Console.cs
+++ b/cicm_web/Models/Console.cs
@@ -99,7 +99,7 @@ namespace cicm_web.Models
List items = new List();
foreach(Cicm.Database.Schemas.Machine dbItem in dbItems)
- if(dbItem.Year == year)
+ if(dbItem.Introduced.Year == year)
items.Add(MachineMini.TransformItem(dbItem));
return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Model).ToArray();
diff --git a/cicm_web/Models/Machine.cs b/cicm_web/Models/Machine.cs
index cad82133..0ca897ef 100644
--- a/cicm_web/Models/Machine.cs
+++ b/cicm_web/Models/Machine.cs
@@ -40,13 +40,13 @@ namespace cicm_web.Models
public Company Company;
public GpuByMachine[] Gpus;
public int Id;
+ public DateTime Introduced;
public MemoryByMachine[] Memories;
public string Model;
public ProcessorByMachine[] Processors;
public SoundByMachine[] SoundSynths;
public StorageByMachine[] Storage;
public MachineType Type;
- public int Year;
public static Machine[] GetAllItems()
{
@@ -83,7 +83,7 @@ namespace cicm_web.Models
Gpus = GpuByMachine.GetAllItems(dbItem.Id),
Id = dbItem.Id,
Model = dbItem.Model,
- Year = dbItem.Year,
+ Introduced = dbItem.Introduced,
Type = dbItem.Type,
Processors = ProcessorByMachine.GetAllItems(dbItem.Id),
SoundSynths = SoundByMachine.GetAllItems(dbItem.Id),
@@ -134,7 +134,7 @@ namespace cicm_web.Models
List items = new List();
foreach(Cicm.Database.Schemas.Machine dbItem in dbItems)
- if(dbItem.Year == year)
+ if(dbItem.Introduced.Year == year)
items.Add(TransformItem(dbItem));
return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Model).ToArray();
diff --git a/cicm_web/Views/Machine/View.cshtml b/cicm_web/Views/Machine/View.cshtml
index bc138b63..52cf4705 100644
--- a/cicm_web/Views/Machine/View.cshtml
+++ b/cicm_web/Views/Machine/View.cshtml
@@ -59,7 +59,7 @@
}
-@if(Model.Year == 1000)
+@if(Model.Introduced.Year == 1000)
{
PROTOTYPE
@@ -73,20 +73,20 @@
@Model.Company.Name @Model.Model
-@if(Model.Year != 1000)
+@if(Model.Introduced.Year != 1000)
{
|
- Year
+ Introduction date
|
- @Model.Year
+ asp-route-id="@Model.Introduced.Year">
+ @Model.Introduced.ToLongDateString()
|
}
diff --git a/cicm_web/cicm_web.csproj b/cicm_web/cicm_web.csproj
index cf74104c..543a8d03 100644
--- a/cicm_web/cicm_web.csproj
+++ b/cicm_web/cicm_web.csproj
@@ -2,7 +2,7 @@
netcoreapp2.0
- 3.0.99.222
+ 3.0.99.226
Canary Islands Computer Museum
Copyright © 2003-2018 Natalia Portillo
Canary Islands Computer Museum Website