Rename logos in company model.

This commit is contained in:
2018-08-07 21:47:29 +01:00
parent a2256ebe1b
commit 31f6cb7744
5 changed files with 2405 additions and 1271 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,41 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : 20180807193120_CorrectLogosInCompany.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Renames logos in company.
//
// --[ 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 <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2018 Natalia Portillo
*******************************************************************************/
using Microsoft.EntityFrameworkCore.Migrations;
namespace Cicm.Database.Migrations
{
public partial class CorrectLogosInCompany : Migration
{
protected override void Up(MigrationBuilder migrationBuilder) { }
protected override void Down(MigrationBuilder migrationBuilder) { }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -30,6 +30,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Cicm.Database.Models namespace Cicm.Database.Models
{ {
@@ -37,7 +38,7 @@ namespace Cicm.Database.Models
{ {
public Company() public Company()
{ {
CompanyLogos = new HashSet<CompanyLogo>(); Logos = new HashSet<CompanyLogo>();
Gpus = new HashSet<Gpu>(); Gpus = new HashSet<Gpu>();
InverseSoldToNavigation = new HashSet<Company>(); InverseSoldToNavigation = new HashSet<Company>();
MachineFamilies = new HashSet<MachineFamily>(); MachineFamilies = new HashSet<MachineFamily>();
@@ -64,12 +65,14 @@ namespace Cicm.Database.Models
public virtual Iso31661Numeric Country { get; set; } public virtual Iso31661Numeric Country { get; set; }
public virtual Company SoldTo { get; set; } public virtual Company SoldTo { get; set; }
public virtual CompanyDescription Description { get; set; } public virtual CompanyDescription Description { get; set; }
public virtual ICollection<CompanyLogo> CompanyLogos { get; set; } public virtual ICollection<CompanyLogo> Logos { get; set; }
public virtual ICollection<Gpu> Gpus { get; set; } public virtual ICollection<Gpu> Gpus { get; set; }
public virtual ICollection<Company> InverseSoldToNavigation { get; set; } public virtual ICollection<Company> InverseSoldToNavigation { get; set; }
public virtual ICollection<MachineFamily> MachineFamilies { get; set; } public virtual ICollection<MachineFamily> MachineFamilies { get; set; }
public virtual ICollection<Machine> Machines { get; set; } public virtual ICollection<Machine> Machines { get; set; }
public virtual ICollection<Processor> Processors { get; set; } public virtual ICollection<Processor> Processors { get; set; }
public virtual ICollection<SoundSynth> SoundSynths { get; set; } public virtual ICollection<SoundSynth> SoundSynths { get; set; }
public virtual CompanyLogo LastLogo =>
Logos?.OrderByDescending(l => l.Year).FirstOrDefault();
} }
} }

View File

@@ -273,7 +273,7 @@ namespace Cicm.Database.Models
entity.Property(e => e.Year).HasColumnName("year").HasColumnType("int(4)"); entity.Property(e => e.Year).HasColumnName("year").HasColumnType("int(4)");
entity.HasOne(d => d.Company).WithMany(p => p.CompanyLogos).HasForeignKey(d => d.CompanyId) entity.HasOne(d => d.Company).WithMany(p => p.Logos).HasForeignKey(d => d.CompanyId)
.OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("fk_company_logos_company1"); .OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("fk_company_logos_company1");
}); });