mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Use EF in company controller.
This commit is contained in:
@@ -28,21 +28,23 @@
|
|||||||
// Copyright © 2003-2018 Natalia Portillo
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
using cicm_web.Models;
|
using System.Linq;
|
||||||
using Cicm.Database.Schemas;
|
using Cicm.Database.Models;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Company = cicm_web.Models.Company;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace cicm_web.Controllers
|
namespace cicm_web.Controllers
|
||||||
{
|
{
|
||||||
public class CompanyController : Controller
|
public class CompanyController : Controller
|
||||||
{
|
{
|
||||||
|
readonly cicmContext _context;
|
||||||
readonly IHostingEnvironment hostingEnvironment;
|
readonly IHostingEnvironment hostingEnvironment;
|
||||||
|
|
||||||
public CompanyController(IHostingEnvironment env)
|
public CompanyController(IHostingEnvironment env, cicmContext context)
|
||||||
{
|
{
|
||||||
hostingEnvironment = env;
|
hostingEnvironment = env;
|
||||||
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult ByLetter(char id)
|
public IActionResult ByLetter(char id)
|
||||||
@@ -54,36 +56,40 @@ namespace cicm_web.Controllers
|
|||||||
|
|
||||||
ViewBag.Letter = id;
|
ViewBag.Letter = id;
|
||||||
|
|
||||||
Company[] companies = id == '\0' ? Company.GetAllItems() : Company.GetItemsStartingWithLetter(id);
|
|
||||||
|
|
||||||
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
|
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
|
||||||
return View(companies);
|
return View(id == '\0'
|
||||||
|
? _context.Companies.ToArray()
|
||||||
|
: _context.Companies.Where(c => c.Name.StartsWith(id)).ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult View(int id)
|
public IActionResult View(int id)
|
||||||
{
|
{
|
||||||
CompanyWithItems company = CompanyWithItems.GetItem(id);
|
|
||||||
|
|
||||||
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
|
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
|
||||||
|
Companies company = _context.Companies.Where(c => c.Id == id).Include(c => c.Description)
|
||||||
|
.Include(c => c.Machines).Include(c => c.Country).FirstOrDefault();
|
||||||
|
|
||||||
|
if(company == null) return Index();
|
||||||
|
|
||||||
|
ViewBag.LastLogo = company.CompanyLogos.OrderByDescending(l => l.Year).FirstOrDefault();
|
||||||
|
ViewBag.CompanyLogos = company.CompanyLogos.OrderByDescending(l => l.Year).ToList();
|
||||||
|
|
||||||
return View(company);
|
return View(company);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult ByCountry(short id)
|
public IActionResult ByCountry(short id)
|
||||||
{
|
{
|
||||||
Iso3166 iso3166 = Program.Database.Operations.GetIso3166(id);
|
ViewBag.Iso3166 = _context.Iso31661Numeric.FirstOrDefault(i => i.Id == id);
|
||||||
|
|
||||||
ViewBag.Iso3166 = iso3166;
|
|
||||||
|
|
||||||
Company[] companies = iso3166 == null ? Company.GetAllItems() : Company.GetItemsByCountry(id);
|
|
||||||
|
|
||||||
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
|
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
|
||||||
return View(companies);
|
return View(ViewBag.Iso3166 == null
|
||||||
|
? _context.Companies.ToArray()
|
||||||
|
: _context.Companies.Where(c => c.CountryId == id).ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
|
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
|
||||||
return View(Company.GetAllItems());
|
return View(_context.Companies.ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Cicm.Database;
|
||||||
using Cicm.Database.Schemas;
|
using Cicm.Database.Schemas;
|
||||||
using Markdig;
|
using Markdig;
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Cicm.Database.Schemas;
|
using Cicm.Database;
|
||||||
|
|
||||||
namespace cicm_web.Models
|
namespace cicm_web.Models
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,16 +29,16 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Cicm.Database.Schemas;
|
using Cicm.Database;
|
||||||
|
|
||||||
namespace cicm_web.Models
|
namespace cicm_web.Models
|
||||||
{
|
{
|
||||||
public class MemoryByMachine
|
public class MemoryByMachine
|
||||||
{
|
{
|
||||||
public MemoryType Type;
|
public long Size;
|
||||||
|
public double Speed;
|
||||||
|
public MemoryType Type;
|
||||||
public MemoryUsage Usage;
|
public MemoryUsage Usage;
|
||||||
public long Size;
|
|
||||||
public double Speed;
|
|
||||||
|
|
||||||
public static MemoryByMachine[] GetAllItems(int machineId)
|
public static MemoryByMachine[] GetAllItems(int machineId)
|
||||||
{
|
{
|
||||||
@@ -52,10 +52,10 @@ namespace cicm_web.Models
|
|||||||
foreach(Cicm.Database.Schemas.MemoryByMachine dbItem in dbItems)
|
foreach(Cicm.Database.Schemas.MemoryByMachine dbItem in dbItems)
|
||||||
items.Add(new MemoryByMachine
|
items.Add(new MemoryByMachine
|
||||||
{
|
{
|
||||||
Type =dbItem.Type,
|
Type = dbItem.Type,
|
||||||
Usage =dbItem.Usage,
|
Usage = dbItem.Usage,
|
||||||
Size =dbItem.Size,
|
Size = dbItem.Size,
|
||||||
Speed =dbItem.Speed
|
Speed = dbItem.Speed
|
||||||
});
|
});
|
||||||
|
|
||||||
return items.ToArray();
|
return items.ToArray();
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Cicm.Database.Schemas;
|
using Cicm.Database;
|
||||||
|
|
||||||
namespace cicm_web.Models
|
namespace cicm_web.Models
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Cicm.Database.Schemas;
|
using Cicm.Database;
|
||||||
|
|
||||||
namespace cicm_web.Models
|
namespace cicm_web.Models
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Cicm.Database.Schemas;
|
using Cicm.Database;
|
||||||
|
|
||||||
namespace cicm_web.Models
|
namespace cicm_web.Models
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Cicm.Database.Schemas;
|
using Cicm.Database;
|
||||||
|
|
||||||
namespace cicm_web.Models
|
namespace cicm_web.Models
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,9 +32,10 @@
|
|||||||
ViewData["Title"] = "Companies";
|
ViewData["Title"] = "Companies";
|
||||||
}
|
}
|
||||||
@using System.IO
|
@using System.IO
|
||||||
@model IEnumerable<Company>
|
@using Cicm.Database.Models
|
||||||
|
@model Cicm.Database.Models.Companies[]
|
||||||
|
|
||||||
<p align=center>
|
<p align="center">
|
||||||
@if(ViewBag.Iso3166 != null)
|
@if(ViewBag.Iso3166 != null)
|
||||||
{
|
{
|
||||||
<b>Companies founded in @ViewBag.Iso3166.Name</b>
|
<b>Companies founded in @ViewBag.Iso3166.Name</b>
|
||||||
@@ -62,11 +63,12 @@
|
|||||||
{
|
{
|
||||||
<p>
|
<p>
|
||||||
@Model.Count() companies found in the database.<br />
|
@Model.Count() companies found in the database.<br />
|
||||||
@foreach(Company company in Model)
|
@foreach(Companies company in Model)
|
||||||
{
|
{
|
||||||
<a asp-controller="Company"
|
<a asp-controller="Company"
|
||||||
asp-action="View"
|
asp-action="View"
|
||||||
asp-route-id="@company.Id">
|
asp-route-id="@company.Id">
|
||||||
|
@* TODO
|
||||||
@if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg")))
|
@if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg")))
|
||||||
{
|
{
|
||||||
<picture>
|
<picture>
|
||||||
@@ -86,6 +88,7 @@
|
|||||||
style="max-height: 32px; max-width: 128px" />
|
style="max-height: 32px; max-width: 128px" />
|
||||||
</picture>
|
</picture>
|
||||||
}
|
}
|
||||||
|
*@
|
||||||
@company.Name
|
@company.Name
|
||||||
</a>
|
</a>
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
@@ -31,11 +31,11 @@
|
|||||||
|
|
||||||
ViewData["Title"] = "Companies";
|
ViewData["Title"] = "Companies";
|
||||||
}
|
}
|
||||||
@using System.IO
|
@using Cicm.Database.Models
|
||||||
@model IEnumerable<Company>
|
@model Cicm.Database.Models.Companies[]
|
||||||
|
|
||||||
<p>Search results:</p>
|
<p>Search results:</p>
|
||||||
<p align=center>
|
<p align="center">
|
||||||
@if(ViewBag.Letter != '\0')
|
@if(ViewBag.Letter != '\0')
|
||||||
{
|
{
|
||||||
<b>@ViewBag.Letter</b>
|
<b>@ViewBag.Letter</b>
|
||||||
@@ -46,11 +46,12 @@
|
|||||||
{
|
{
|
||||||
<p>
|
<p>
|
||||||
@Model.Count() companies found in the database.<br />
|
@Model.Count() companies found in the database.<br />
|
||||||
@foreach(Company company in Model)
|
@foreach(Companies company in Model)
|
||||||
{
|
{
|
||||||
<a asp-controller="Company"
|
<a asp-controller="Company"
|
||||||
asp-action="View"
|
asp-action="View"
|
||||||
asp-route-id="@company.Id">
|
asp-route-id="@company.Id">
|
||||||
|
@*
|
||||||
@if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg")))
|
@if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg")))
|
||||||
{
|
{
|
||||||
<picture>
|
<picture>
|
||||||
@@ -70,6 +71,7 @@
|
|||||||
style="max-height: 32px; max-width: 128px" />
|
style="max-height: 32px; max-width: 128px" />
|
||||||
</picture>
|
</picture>
|
||||||
}
|
}
|
||||||
|
*@
|
||||||
@company.Name
|
@company.Name
|
||||||
</a>
|
</a>
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
@@ -31,19 +31,20 @@
|
|||||||
|
|
||||||
ViewData["Title"] = "Companies";
|
ViewData["Title"] = "Companies";
|
||||||
}
|
}
|
||||||
@using System.IO
|
@using Cicm.Database.Models
|
||||||
@model IEnumerable<Company>
|
@model Cicm.Database.Models.Companies[]
|
||||||
|
|
||||||
<p align=center>
|
<p align="center">
|
||||||
@if(Model.Any())
|
@if(Model.Any())
|
||||||
{
|
{
|
||||||
<p>
|
<p>
|
||||||
@Model.Count() companies found in the database.<br />
|
@Model.Count() companies found in the database.<br />
|
||||||
@foreach(Company company in Model)
|
@foreach(Companies company in Model)
|
||||||
{
|
{
|
||||||
<a asp-controller="Company"
|
<a asp-controller="Company"
|
||||||
asp-action="View"
|
asp-action="View"
|
||||||
asp-route-id="@company.Id">
|
asp-route-id="@company.Id">
|
||||||
|
@* TODO
|
||||||
@if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg")))
|
@if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg")))
|
||||||
{
|
{
|
||||||
<picture>
|
<picture>
|
||||||
@@ -58,10 +59,13 @@
|
|||||||
/assets/logos/thumbs/png/1x/@(company.LastLogo.Guid).webp 3x"
|
/assets/logos/thumbs/png/1x/@(company.LastLogo.Guid).webp 3x"
|
||||||
src="/assets/logos/thumbs/png/1x@(company.LastLogo.Guid).png")
|
src="/assets/logos/thumbs/png/1x@(company.LastLogo.Guid).png")
|
||||||
alt=""
|
alt=""
|
||||||
height="auto" width="auto" style="max-height: 32px; max-width: 128px "/>
|
height="auto"
|
||||||
|
width="auto"
|
||||||
|
style="max-height: 32px; max-width: 128px" />
|
||||||
</picture>
|
</picture>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*@
|
||||||
@company.Name
|
@company.Name
|
||||||
</a>
|
</a>
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
@@ -32,26 +32,27 @@
|
|||||||
ViewData["Title"] = "Companies";
|
ViewData["Title"] = "Companies";
|
||||||
}
|
}
|
||||||
@using System.IO
|
@using System.IO
|
||||||
@using Cicm.Database.Schemas
|
@using Cicm.Database
|
||||||
@model CompanyWithItems
|
@using Cicm.Database.Models
|
||||||
|
@model Cicm.Database.Models.Companies
|
||||||
|
|
||||||
@if(Model != null)
|
@if(Model != null)
|
||||||
{
|
{
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<p align=center>
|
<p align=center>
|
||||||
@if(Model.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.LastLogo.Guid + ".svg")))
|
@if(ViewBag.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", ViewBag.LastLogo.Guid + ".svg")))
|
||||||
{
|
{
|
||||||
<picture>
|
<picture>
|
||||||
<source type="image/svg+xml"
|
<source type="image/svg+xml"
|
||||||
srcset="/assets/logos/@(Model.LastLogo.Guid).svg">
|
srcset="/assets/logos/@(ViewBag.LastLogo.Guid).svg">
|
||||||
<source type="image/webp"
|
<source type="image/webp"
|
||||||
srcset="/assets/logos/webp/1x/@(Model.LastLogo.Guid).webp,
|
srcset="/assets/logos/webp/1x/@(ViewBag.LastLogo.Guid).webp,
|
||||||
/assets/logos/webp/1x/@(Model.LastLogo.Guid).webp 2x,
|
/assets/logos/webp/1x/@(ViewBag.LastLogo.Guid).webp 2x,
|
||||||
/assets/logos/webp/1x/@(Model.LastLogo.Guid).webp 3x">
|
/assets/logos/webp/1x/@(ViewBag.LastLogo.Guid).webp 3x">
|
||||||
<img srcset="/assets/logos/png/1x/@(Model.LastLogo.Guid).png,
|
<img srcset="/assets/logos/png/1x/@(ViewBag.LastLogo.Guid).png,
|
||||||
/assets/logos/png/1x/@(Model.LastLogo.Guid).png 2x,
|
/assets/logos/png/1x/@(ViewBag.LastLogo.Guid).png 2x,
|
||||||
/assets/logos/png/1x/@(Model.LastLogo.Guid).webp 3x"
|
/assets/logos/png/1x/@(ViewBag.LastLogo.Guid).webp 3x"
|
||||||
src="/assets/logos/png/1x@(Model.LastLogo.Guid).png")
|
src="/assets/logos/png/1x@(ViewBag.LastLogo.Guid).png")
|
||||||
alt=""
|
alt=""
|
||||||
height="auto"
|
height="auto"
|
||||||
width="auto"
|
width="auto"
|
||||||
@@ -63,7 +64,7 @@
|
|||||||
@{
|
@{
|
||||||
string carrouselActive = "active";
|
string carrouselActive = "active";
|
||||||
}
|
}
|
||||||
@if(Model.Logos != null && Model.Logos.Length > 1)
|
@if(ViewBag.Logos != null && ViewBag.Logos.Length > 1)
|
||||||
{
|
{
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<div class="carousel slide"
|
<div class="carousel slide"
|
||||||
@@ -72,7 +73,7 @@
|
|||||||
<div class="carousel-inner">
|
<div class="carousel-inner">
|
||||||
|
|
||||||
|
|
||||||
@foreach(CompanyLogo logo in Model.Logos)
|
@foreach(CompanyLogos logo in ViewBag.Logos)
|
||||||
{
|
{
|
||||||
if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", logo.Guid + ".svg")))
|
if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", logo.Guid + ".svg")))
|
||||||
{
|
{
|
||||||
@@ -129,11 +130,11 @@
|
|||||||
<b>@Model.Name</b>
|
<b>@Model.Name</b>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@if(Model.Founded > DateTime.MinValue)
|
@if(Model.Founded.HasValue)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<th>Founded</th>
|
<th>Founded</th>
|
||||||
<td>@Model.Founded.ToLongDateString().</td>
|
<td>@Model.Founded.Value.ToLongDateString().</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
<tr>
|
<tr>
|
||||||
@@ -183,12 +184,12 @@
|
|||||||
<a asp-controller="Company"
|
<a asp-controller="Company"
|
||||||
asp-action="View"
|
asp-action="View"
|
||||||
asp-route-id="@Model.SoldTo.Id">
|
asp-route-id="@Model.SoldTo.Id">
|
||||||
@Model.SoldTo.Name</a> on @Model.Sold.ToLongDateString().
|
@Model.SoldTo.Name</a> on @Model.Sold.Value.ToLongDateString().
|
||||||
</td>
|
</td>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<td>Company was sold on @Model.Sold.ToLongDateString() to an unknown company.</td>
|
<td>Company was sold on @Model.Sold.Value.ToLongDateString() to an unknown company.</td>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -215,7 +216,7 @@
|
|||||||
if(Model.SoldTo != null)
|
if(Model.SoldTo != null)
|
||||||
{
|
{
|
||||||
<td>
|
<td>
|
||||||
Company was merged on @Model.Sold.ToLongDateString() to form
|
Company was merged on @Model.Sold.Value.ToLongDateString() to form
|
||||||
<a asp-controller="Company"
|
<a asp-controller="Company"
|
||||||
asp-action="View"
|
asp-action="View"
|
||||||
asp-route-id="@Model.SoldTo.Id">
|
asp-route-id="@Model.SoldTo.Id">
|
||||||
@@ -224,7 +225,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<td>Company was merge on @Model.Sold.ToLongDateString() to form an unknown company.</td>
|
<td>Company was merge on @Model.Sold.Value.ToLongDateString() to form an unknown company.</td>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -248,7 +249,7 @@
|
|||||||
case CompanyStatus.Bankrupt:
|
case CompanyStatus.Bankrupt:
|
||||||
if(Model.Sold != DateTime.MinValue)
|
if(Model.Sold != DateTime.MinValue)
|
||||||
{
|
{
|
||||||
<td>Company declared bankruptcy on @Model.Sold.ToLongDateString().</td>
|
<td>Company declared bankruptcy on @Model.Sold.Value.ToLongDateString().</td>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -258,7 +259,7 @@
|
|||||||
case CompanyStatus.Defunct:
|
case CompanyStatus.Defunct:
|
||||||
if(Model.Sold != DateTime.MinValue)
|
if(Model.Sold != DateTime.MinValue)
|
||||||
{
|
{
|
||||||
<td>Company ceased operations on @Model.Sold.ToLongDateString().</td>
|
<td>Company ceased operations on @Model.Sold.Value.ToLongDateString().</td>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -275,12 +276,12 @@
|
|||||||
<a asp-controller="Company"
|
<a asp-controller="Company"
|
||||||
asp-action="View"
|
asp-action="View"
|
||||||
asp-route-id="@Model.SoldTo.Id">
|
asp-route-id="@Model.SoldTo.Id">
|
||||||
@Model.SoldTo.Name</a> on @Model.Sold.ToLongDateString().
|
@Model.SoldTo.Name</a> on @Model.Sold.Value.ToLongDateString().
|
||||||
</td>
|
</td>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<td>Company was renamed on @Model.Sold.ToLongDateString() to an unknown name.</td>
|
<td>Company was renamed on @Model.Sold.Value.ToLongDateString() to an unknown name.</td>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -345,7 +346,7 @@
|
|||||||
<div class="row"
|
<div class="row"
|
||||||
id="itemsAccordion">
|
id="itemsAccordion">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@if(Model.Computers.Any())
|
@if(Model.Machines.Any(t => t.Type == MachineType.Computer))
|
||||||
{
|
{
|
||||||
<div class="card-header"
|
<div class="card-header"
|
||||||
id="headingComputers">
|
id="headingComputers">
|
||||||
@@ -355,7 +356,7 @@
|
|||||||
class="btn btn-info"
|
class="btn btn-info"
|
||||||
data-target="#collapseComputers"
|
data-target="#collapseComputers"
|
||||||
data-toggle="collapse">
|
data-toggle="collapse">
|
||||||
<span class="badge badge-success">@Model.Computers.Count()</span> computers known.
|
<span class="badge badge-success">@Model.Machines.Count(t => t.Type == MachineType.Computer)</span> computers known.
|
||||||
</button>
|
</button>
|
||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
@@ -365,7 +366,7 @@
|
|||||||
data-parent="#itemsAccordion"
|
data-parent="#itemsAccordion"
|
||||||
id="collapseComputers">
|
id="collapseComputers">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@foreach(MachineMini computer in Model.Computers)
|
@foreach(Machines computer in Model.Machines.Where(t => t.Type == MachineType.Computer))
|
||||||
{
|
{
|
||||||
<a asp-controller="Machine"
|
<a asp-controller="Machine"
|
||||||
asp-action="View"
|
asp-action="View"
|
||||||
@@ -387,7 +388,7 @@
|
|||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if(Model.Consoles.Any())
|
@if(Model.Machines.Any(t => t.Type == MachineType.Console))
|
||||||
{
|
{
|
||||||
<div class="card-header"
|
<div class="card-header"
|
||||||
id="headingConsoles">
|
id="headingConsoles">
|
||||||
@@ -397,7 +398,7 @@
|
|||||||
class="btn btn-info"
|
class="btn btn-info"
|
||||||
data-target="#collapseConsoles"
|
data-target="#collapseConsoles"
|
||||||
data-toggle="collapse">
|
data-toggle="collapse">
|
||||||
<span class="badge badge-success">@Model.Consoles.Count()</span> videogame consoles known.
|
<span class="badge badge-success">@Model.Machines.Count(t => t.Type == MachineType.Console)</span> videogame consoles known.
|
||||||
</button>
|
</button>
|
||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
@@ -407,7 +408,7 @@
|
|||||||
data-parent="#itemsAccordion"
|
data-parent="#itemsAccordion"
|
||||||
id="collapseConsoles">
|
id="collapseConsoles">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@foreach(MachineMini console in Model.Consoles)
|
@foreach(Machines console in Model.Machines.Where(t => t.Type == MachineType.Console))
|
||||||
{
|
{
|
||||||
<a asp-controller="Machine"
|
<a asp-controller="Machine"
|
||||||
asp-action="View"
|
asp-action="View"
|
||||||
@@ -432,6 +433,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@* TODO: This is not working with EF, check why *@
|
||||||
@if(Model.Description != null)
|
@if(Model.Description != null)
|
||||||
{
|
{
|
||||||
<div class="container-fluid row">
|
<div class="container-fluid row">
|
||||||
|
|||||||
@@ -32,12 +32,10 @@
|
|||||||
ViewData["Title"] = "Computer";
|
ViewData["Title"] = "Computer";
|
||||||
}
|
}
|
||||||
@using System.IO
|
@using System.IO
|
||||||
@using Cicm.Database.Schemas
|
@using Cicm.Database
|
||||||
@using MemoryByMachine = cicm_web.Models.MemoryByMachine
|
@model Machine
|
||||||
@using StorageByMachine = cicm_web.Models.StorageByMachine
|
|
||||||
@model cicm_web.Models.Machine
|
|
||||||
|
|
||||||
<p align=center>
|
<p align="center">
|
||||||
@if(Model.Company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Company.LastLogo.Guid + ".svg")))
|
@if(Model.Company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Company.LastLogo.Guid + ".svg")))
|
||||||
{
|
{
|
||||||
<picture>
|
<picture>
|
||||||
@@ -67,11 +65,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<b>
|
<b>
|
||||||
<a asp-controller=Company
|
<a asp-controller="Company"
|
||||||
asp-action=View
|
asp-action="View"
|
||||||
asp-route-id=@Model.Company.Id>
|
asp-route-id="@Model.Company.Id">
|
||||||
@Model.Company.Name</a> @Model.Name</b>
|
@Model.Company.Name</a> @Model.Name</b>
|
||||||
<table width=100%>
|
<table width="100%">
|
||||||
|
|
||||||
@if(Model.Introduced.Year != 1000)
|
@if(Model.Introduced.Year != 1000)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
<Version>3.0.99.279</Version>
|
<Version>3.0.99.289</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