mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 11:04:25 +00:00
Refactor and reorganize code.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
@@ -36,27 +37,18 @@ namespace Marechai.Database
|
||||
{
|
||||
public enum NewsType
|
||||
{
|
||||
NewComputerInDb = 1,
|
||||
NewConsoleInDb = 2,
|
||||
NewComputerInCollection = 3,
|
||||
NewConsoleInCollection = 4,
|
||||
UpdatedComputerInDb = 5,
|
||||
UpdatedConsoleInDb = 6,
|
||||
UpdatedComputerInCollection = 7,
|
||||
UpdatedConsoleInCollection = 8,
|
||||
NewMoneyDonation = 9
|
||||
NewComputerInDb = 1, NewConsoleInDb = 2, NewComputerInCollection = 3,
|
||||
NewConsoleInCollection = 4, UpdatedComputerInDb = 5, UpdatedConsoleInDb = 6,
|
||||
UpdatedComputerInCollection = 7, UpdatedConsoleInCollection = 8, NewMoneyDonation = 9
|
||||
}
|
||||
|
||||
public enum StatusType
|
||||
{
|
||||
[Display(Name = "Unknown")]
|
||||
Unknown = 0,
|
||||
[Display(Name = "Tested good")]
|
||||
TestedGood = 1,
|
||||
[Display(Name = "Not tested")]
|
||||
NotTested = 2,
|
||||
[Display(Name = "Tested bad")]
|
||||
TestedBad = 3
|
||||
Unknown = 0, [Display(Name = "Tested good")]
|
||||
TestedGood = 1, [Display(Name = "Not tested")]
|
||||
NotTested = 2, [Display(Name = "Tested bad")]
|
||||
TestedBad = 3
|
||||
}
|
||||
|
||||
public enum CompanyStatus
|
||||
@@ -243,22 +235,15 @@ namespace Marechai.Database
|
||||
/// <summary>Pioneer LaserDisc</summary>
|
||||
LD = 21,
|
||||
/// <summary>Pioneer LaserDisc data</summary>
|
||||
LDROM = 22,
|
||||
LDROM2 = 23,
|
||||
LVROM = 24,
|
||||
MegaLD = 254,
|
||||
LDROM = 22, LDROM2 = 23, LVROM = 24, MegaLD = 254,
|
||||
/// <summary>Sony Hi-MD</summary>
|
||||
HiMD = 26,
|
||||
/// <summary>Sony MiniDisc</summary>
|
||||
MD = 27,
|
||||
MDData = 28,
|
||||
MDData2 = 29,
|
||||
MD = 27, MDData = 28, MDData2 = 29,
|
||||
/// <summary>5.25", Phase-Change, 1834348 sectors, 8192 bytes/sector, Ultra Density Optical, ECMA-350, ISO 17345</summary>
|
||||
UDO = 30,
|
||||
/// <summary>5.25", Phase-Change, 3669724 sectors, 8192 bytes/sector, Ultra Density Optical 2, ECMA-380, ISO 11976</summary>
|
||||
UDO2 = 31,
|
||||
PlayStationMemoryCard = 32,
|
||||
PlayStationMemoryCard2 = 33,
|
||||
UDO2 = 31, PlayStationMemoryCard = 32, PlayStationMemoryCard2 = 33,
|
||||
/// <summary>Sony PlayStation game CD</summary>
|
||||
PS1CD = 34,
|
||||
/// <summary>Sony PlayStation 2 game CD</summary>
|
||||
@@ -286,8 +271,7 @@ namespace Marechai.Database
|
||||
/// <summary>Sega Saturn disc</summary>
|
||||
SATURNCD = 46,
|
||||
/// <summary>Sega/Yamaha Gigabyte Disc</summary>
|
||||
GDROM = 47,
|
||||
SegaCard = 48,
|
||||
GDROM = 47, SegaCard = 48,
|
||||
/// <summary>PC-Engine / TurboGrafx cartridge</summary>
|
||||
HuCard = 49,
|
||||
/// <summary>PC-Engine / TurboGrafx CD</summary>
|
||||
@@ -307,383 +291,212 @@ namespace Marechai.Database
|
||||
/// <summary>3.5" floppy</summary>
|
||||
Microfloppy = 57,
|
||||
/// <summary>5.25", DS, ?D, ?? tracks, ?? spt, 512 bytes/sector, GCR, opposite side heads, aka Twiggy</summary>
|
||||
AppleFileWare = 58,
|
||||
Bernoulli = 59,
|
||||
Bernoulli2 = 60,
|
||||
Ditto = 61,
|
||||
DittoMax = 62,
|
||||
Jaz = 63,
|
||||
Jaz2 = 64,
|
||||
PocketZip = 65,
|
||||
REV120 = 66,
|
||||
REV35 = 67,
|
||||
REV70 = 68,
|
||||
ZIP100 = 69,
|
||||
ZIP250 = 70,
|
||||
ZIP750 = 71,
|
||||
CompactCassette = 72,
|
||||
Data8 = 73,
|
||||
MiniDV = 74,
|
||||
CFast = 75,
|
||||
CompactFlash = 76,
|
||||
CompactFlashType2 = 77,
|
||||
EZ135 = 78,
|
||||
EZ230 = 79,
|
||||
Quest = 80,
|
||||
SparQ = 81,
|
||||
SQ100 = 82,
|
||||
SQ200 = 83,
|
||||
SQ300 = 84,
|
||||
SQ310 = 85,
|
||||
SQ327 = 86,
|
||||
SQ400 = 87,
|
||||
SQ800 = 88,
|
||||
SQ1500 = 89,
|
||||
SQ2000 = 90,
|
||||
SyJet = 91,
|
||||
FamicomGamePak = 92,
|
||||
GameBoyAdvanceGamePak = 93,
|
||||
GameBoyGamePak = 94,
|
||||
GOD = 95,
|
||||
N64DD = 96,
|
||||
N64GamePak = 97,
|
||||
NESGamePak = 98,
|
||||
Nintendo3DSGameCard = 99,
|
||||
NintendoDiskCard = 100,
|
||||
NintendoDSGameCard = 101,
|
||||
NintendoDSiGameCard = 102,
|
||||
SNESGamePak = 103,
|
||||
SNESGamePakUS = 104,
|
||||
WOD = 105,
|
||||
WUOD = 106,
|
||||
SwitchGameCard = 107,
|
||||
MemoryStick = 108,
|
||||
MemoryStickDuo = 109,
|
||||
MemoryStickMicro = 110,
|
||||
MemoryStickPro = 111,
|
||||
MemoryStickProDuo = 112,
|
||||
microSD = 113,
|
||||
miniSD = 114,
|
||||
SecureDigital = 115,
|
||||
MMC = 116,
|
||||
MMCmicro = 117,
|
||||
RSMMC = 118,
|
||||
MMCplus = 118,
|
||||
MMCmobile = 119,
|
||||
eMMC = 120,
|
||||
MO120 = 121,
|
||||
MO90 = 122,
|
||||
MO300 = 123,
|
||||
MO356 = 124,
|
||||
CompactFloppy = 125,
|
||||
DemiDiskette = 126,
|
||||
AppleFileWare = 58, Bernoulli = 59, Bernoulli2 = 60, Ditto = 61,
|
||||
DittoMax = 62, Jaz = 63, Jaz2 = 64,
|
||||
PocketZip = 65, REV120 = 66, REV35 = 67,
|
||||
REV70 = 68, ZIP100 = 69, ZIP250 = 70,
|
||||
ZIP750 = 71, CompactCassette = 72, Data8 = 73,
|
||||
MiniDV = 74, CFast = 75, CompactFlash = 76,
|
||||
CompactFlashType2 = 77, EZ135 = 78, EZ230 = 79,
|
||||
Quest = 80, SparQ = 81, SQ100 = 82,
|
||||
SQ200 = 83, SQ300 = 84, SQ310 = 85,
|
||||
SQ327 = 86, SQ400 = 87, SQ800 = 88,
|
||||
SQ1500 = 89, SQ2000 = 90, SyJet = 91,
|
||||
FamicomGamePak = 92, GameBoyAdvanceGamePak = 93, GameBoyGamePak = 94,
|
||||
GOD = 95, N64DD = 96, N64GamePak = 97,
|
||||
NESGamePak = 98, Nintendo3DSGameCard = 99, NintendoDiskCard = 100,
|
||||
NintendoDSGameCard = 101, NintendoDSiGameCard = 102, SNESGamePak = 103,
|
||||
SNESGamePakUS = 104, WOD = 105, WUOD = 106,
|
||||
SwitchGameCard = 107, MemoryStick = 108, MemoryStickDuo = 109,
|
||||
MemoryStickMicro = 110, MemoryStickPro = 111, MemoryStickProDuo = 112,
|
||||
microSD = 113, miniSD = 114, SecureDigital = 115,
|
||||
MMC = 116, MMCmicro = 117, RSMMC = 118,
|
||||
MMCplus = 118, MMCmobile = 119, eMMC = 120,
|
||||
MO120 = 121, MO90 = 122, MO300 = 123,
|
||||
MO356 = 124, CompactFloppy = 125, DemiDiskette = 126,
|
||||
/// <summary>3.5", 652 tracks, 2 sides, 512 bytes/sector, Floptical, ECMA-207, ISO 14169</summary>
|
||||
Floptical = 127,
|
||||
HiFD = 128,
|
||||
QuickDisk = 129,
|
||||
UHD144 = 130,
|
||||
VideoFloppy = 131,
|
||||
Wafer = 132,
|
||||
ZXMicrodrive = 133,
|
||||
BeeCard = 134,
|
||||
Borsu = 135,
|
||||
DataStore = 136,
|
||||
MiniCard = 137,
|
||||
Orb = 138,
|
||||
Orb5 = 139,
|
||||
SmartMedia = 140,
|
||||
xD = 141,
|
||||
XQD = 142,
|
||||
DataPlay = 143,
|
||||
LS120 = 144,
|
||||
LS240 = 145,
|
||||
FD32MB = 146,
|
||||
RDX = 147,
|
||||
PunchedCard = 148
|
||||
Floptical = 127, HiFD = 128, QuickDisk = 129, UHD144 = 130,
|
||||
VideoFloppy = 131, Wafer = 132, ZXMicrodrive = 133,
|
||||
BeeCard = 134, Borsu = 135, DataStore = 136,
|
||||
MiniCard = 137, Orb = 138, Orb5 = 139,
|
||||
SmartMedia = 140, xD = 141, XQD = 142,
|
||||
DataPlay = 143, LS120 = 144, LS240 = 145,
|
||||
FD32MB = 146, RDX = 147, PunchedCard = 148
|
||||
}
|
||||
|
||||
public enum StorageInterface
|
||||
{
|
||||
Unknown = 0,
|
||||
ACSI = 1,
|
||||
ATA = 2,
|
||||
XTA = 3,
|
||||
ESDI = 4,
|
||||
SCSI = 5,
|
||||
USB = 6,
|
||||
FireWire = 7,
|
||||
SASI = 8,
|
||||
ST506 = 9,
|
||||
IPI = 10,
|
||||
SMD = 11,
|
||||
SATA = 12,
|
||||
SSA = 13,
|
||||
DSSI = 14,
|
||||
HIPPI = 15,
|
||||
SAS = 16,
|
||||
FC = 17,
|
||||
PCIe = 18,
|
||||
M2 = 19,
|
||||
SataExpress = 20
|
||||
Unknown = 0, ACSI = 1, ATA = 2,
|
||||
XTA = 3, ESDI = 4, SCSI = 5,
|
||||
USB = 6, FireWire = 7, SASI = 8,
|
||||
ST506 = 9, IPI = 10, SMD = 11,
|
||||
SATA = 12, SSA = 13, DSSI = 14,
|
||||
HIPPI = 15, SAS = 16, FC = 17,
|
||||
PCIe = 18, M2 = 19, SataExpress = 20
|
||||
}
|
||||
|
||||
public enum ColorSpace : ushort
|
||||
{
|
||||
[Display(Name = "sRGB")]
|
||||
Srgb = 1,
|
||||
[Display(Name = "Adobe RGB")]
|
||||
AdobeRgb = 2,
|
||||
[Display(Name = "Wide Gamut RGB")]
|
||||
WideGamutRgb = 4093,
|
||||
[Display(Name = "ICC Profile")]
|
||||
IccProfile = 65534,
|
||||
[Display(Name = "Uncalibrated")]
|
||||
Srgb = 1, [Display(Name = "Adobe RGB")]
|
||||
AdobeRgb = 2, [Display(Name = "Wide Gamut RGB")]
|
||||
WideGamutRgb = 4093, [Display(Name = "ICC Profile")]
|
||||
IccProfile = 65534, [Display(Name = "Uncalibrated")]
|
||||
Uncalibreated = 65535
|
||||
}
|
||||
|
||||
public enum Contrast : ushort
|
||||
{
|
||||
Normal = 0,
|
||||
Low = 1,
|
||||
Hig = 2
|
||||
Normal = 0, Low = 1, Hig = 2
|
||||
}
|
||||
|
||||
public enum ExposureMode : ushort
|
||||
{
|
||||
Auto = 0,
|
||||
Manual = 1,
|
||||
[Display(Name = "Auto bracket")]
|
||||
Auto = 0, Manual = 1, [Display(Name = "Auto bracket")]
|
||||
AutoBracket = 2
|
||||
}
|
||||
|
||||
public enum ExposureProgram : ushort
|
||||
{
|
||||
[Display(Name = "Not Defined")]
|
||||
Undefined = 0,
|
||||
[Display(Name = "Manual")]
|
||||
Manual = 1,
|
||||
[Display(Name = "Program AE")]
|
||||
ProgramAe = 2,
|
||||
[Display(Name = "Aperture-priority AE")]
|
||||
ApAe = 3,
|
||||
[Display(Name = "Shutter speed priority AE")]
|
||||
ShutterAe = 4,
|
||||
[Display(Name = "Creative (Slow speed)")]
|
||||
Creative = 5,
|
||||
[Display(Name = "Action (High speed)")]
|
||||
Action = 6,
|
||||
[Display(Name = "Portrait")]
|
||||
Portrait = 7,
|
||||
[Display(Name = "Landscape")]
|
||||
Landscape = 8,
|
||||
[Display(Name = "Bulb")]
|
||||
Undefined = 0, [Display(Name = "Manual")]
|
||||
Manual = 1, [Display(Name = "Program AE")]
|
||||
ProgramAe = 2, [Display(Name = "Aperture-priority AE")]
|
||||
ApAe = 3, [Display(Name = "Shutter speed priority AE")]
|
||||
ShutterAe = 4, [Display(Name = "Creative (Slow speed)")]
|
||||
Creative = 5, [Display(Name = "Action (High speed)")]
|
||||
Action = 6, [Display(Name = "Portrait")]
|
||||
Portrait = 7, [Display(Name = "Landscape")]
|
||||
Landscape = 8, [Display(Name = "Bulb")]
|
||||
Bulb = 9
|
||||
}
|
||||
|
||||
public enum Flash : ushort
|
||||
{
|
||||
[Display(Name = "No Flash")]
|
||||
None = 0,
|
||||
[Display(Name = "Fired")]
|
||||
Fired = 1,
|
||||
[Display(Name = "Fired, Return not detected")]
|
||||
FiredNoReturn = 5,
|
||||
[Display(Name = "Fired, Return detected")]
|
||||
FiredReturn = 7,
|
||||
[Display(Name = "On, Did not fire")]
|
||||
OnDidNotFire = 8,
|
||||
[Display(Name = "On, Fired")]
|
||||
OnFired = 9,
|
||||
[Display(Name = "On, Return not detected")]
|
||||
OnNoReturn = 13,
|
||||
[Display(Name = "On, Return detected")]
|
||||
OnReturn = 15,
|
||||
[Display(Name = "Off, Did not fire")]
|
||||
OffDidNotFire = 16,
|
||||
[Display(Name = "Off, Did not fire, Return not detected")]
|
||||
OffDidNotFireNoReturn = 20,
|
||||
[Display(Name = "Auto, Did not fire")]
|
||||
AutoDidNotFire = 24,
|
||||
[Display(Name = "Auto, Fired")]
|
||||
AutoFired = 25,
|
||||
[Display(Name = "Auto, Fired, Return not detected")]
|
||||
AutoFiredNoReturn = 29,
|
||||
[Display(Name = "Auto, Fired, Return detected")]
|
||||
AutoFiredReturn = 31,
|
||||
[Display(Name = "No flash function")]
|
||||
NoFlash = 32,
|
||||
[Display(Name = "Off, No flash function")]
|
||||
OffNoFlash = 48,
|
||||
[Display(Name = "Fired, Red-eye reduction")]
|
||||
FiredRedEye = 65,
|
||||
[Display(Name = "Fired, Red-eye reduction, Return not detected")]
|
||||
FiredRedEyeNoReturn = 69,
|
||||
[Display(Name = "Fired, Red-eye reduction, Return detected")]
|
||||
FiredRedEyeReturn = 71,
|
||||
[Display(Name = "On, Red-eye reduction")]
|
||||
OnRedEye = 73,
|
||||
[Display(Name = "On, Red-eye reduction, Return not detected")]
|
||||
OnRedEyeNoReturn = 77,
|
||||
[Display(Name = "On, Red-eye reduction, Return detected")]
|
||||
OnRedEyeReturn = 79,
|
||||
[Display(Name = "Off, Red-eye reduction")]
|
||||
OffRedEye = 80,
|
||||
[Display(Name = "Auto, Did not fire, Red-eye reduction")]
|
||||
AutoNotFireRedEye = 88,
|
||||
[Display(Name = "Auto, Fired, Red-eye reduction")]
|
||||
AutoFiredRedEye = 89,
|
||||
[Display(Name = "Auto, Fired, Red-eye reduction, Return not detected")]
|
||||
AutoFiredRedEyeNoReturn = 93,
|
||||
[Display(Name = "Auto, Fired, Red-eye reduction, Return detected")]
|
||||
None = 0, [Display(Name = "Fired")]
|
||||
Fired = 1, [Display(Name = "Fired, Return not detected")]
|
||||
FiredNoReturn = 5, [Display(Name = "Fired, Return detected")]
|
||||
FiredReturn = 7, [Display(Name = "On, Did not fire")]
|
||||
OnDidNotFire = 8, [Display(Name = "On, Fired")]
|
||||
OnFired = 9, [Display(Name = "On, Return not detected")]
|
||||
OnNoReturn = 13, [Display(Name = "On, Return detected")]
|
||||
OnReturn = 15, [Display(Name = "Off, Did not fire")]
|
||||
OffDidNotFire = 16, [Display(Name = "Off, Did not fire, Return not detected")]
|
||||
OffDidNotFireNoReturn = 20, [Display(Name = "Auto, Did not fire")]
|
||||
AutoDidNotFire = 24, [Display(Name = "Auto, Fired")]
|
||||
AutoFired = 25, [Display(Name = "Auto, Fired, Return not detected")]
|
||||
AutoFiredNoReturn = 29, [Display(Name = "Auto, Fired, Return detected")]
|
||||
AutoFiredReturn = 31, [Display(Name = "No flash function")]
|
||||
NoFlash = 32, [Display(Name = "Off, No flash function")]
|
||||
OffNoFlash = 48, [Display(Name = "Fired, Red-eye reduction")]
|
||||
FiredRedEye = 65, [Display(Name = "Fired, Red-eye reduction, Return not detected")]
|
||||
FiredRedEyeNoReturn = 69, [Display(Name = "Fired, Red-eye reduction, Return detected")]
|
||||
FiredRedEyeReturn = 71, [Display(Name = "On, Red-eye reduction")]
|
||||
OnRedEye = 73, [Display(Name = "On, Red-eye reduction, Return not detected")]
|
||||
OnRedEyeNoReturn = 77, [Display(Name = "On, Red-eye reduction, Return detected")]
|
||||
OnRedEyeReturn = 79, [Display(Name = "Off, Red-eye reduction")]
|
||||
OffRedEye = 80, [Display(Name = "Auto, Did not fire, Red-eye reduction")]
|
||||
AutoNotFireRedEye = 88, [Display(Name = "Auto, Fired, Red-eye reduction")]
|
||||
AutoFiredRedEye = 89, [Display(Name = "Auto, Fired, Red-eye reduction, Return not detected")]
|
||||
AutoFiredRedEyeNoReturn = 93, [Display(Name = "Auto, Fired, Red-eye reduction, Return detected")]
|
||||
AutoFiredRedEyeReturn = 95
|
||||
}
|
||||
|
||||
public enum LightSource : ushort
|
||||
{
|
||||
[Display(Name = "Unknown")]
|
||||
Unknown = 0,
|
||||
[Display(Name = "Daylight")]
|
||||
Daylight = 1,
|
||||
[Display(Name = "Fluorescent")]
|
||||
Fluorescent = 2,
|
||||
[Display(Name = "Tungsten (Incandescent)")]
|
||||
Incandescent = 3,
|
||||
[Display(Name = "Flash")]
|
||||
Flash = 4,
|
||||
[Display(Name = "Fine Weather")]
|
||||
FineWeather = 9,
|
||||
[Display(Name = "Cloudy")]
|
||||
Cloudy = 10,
|
||||
[Display(Name = "Shade")]
|
||||
Shade = 11,
|
||||
[Display(Name = "Daylight Fluorescent")]
|
||||
DaylightFluorescent = 12,
|
||||
[Display(Name = "Day White Fluorescent")]
|
||||
DayWhiteFluorescent = 13,
|
||||
[Display(Name = "Cool White Fluorescent")]
|
||||
CoolWhiteFluorescent = 14,
|
||||
[Display(Name = "White Fluorescent")]
|
||||
WhiteFluorescent = 15,
|
||||
[Display(Name = "Warm White Fluorescent")]
|
||||
WarmWhiteFluorescent = 16,
|
||||
[Display(Name = "Standard Light A")]
|
||||
StandardLightA = 17,
|
||||
[Display(Name = "Standard Light B")]
|
||||
StandardLightB = 18,
|
||||
[Display(Name = "Standard Light C")]
|
||||
StandardLightC = 19,
|
||||
[Display(Name = "D55")]
|
||||
D55 = 20,
|
||||
[Display(Name = "D65")]
|
||||
D65 = 21,
|
||||
[Display(Name = "D75")]
|
||||
D75 = 22,
|
||||
[Display(Name = "D50")]
|
||||
D50 = 23,
|
||||
[Display(Name = "ISO Studio Tungsten")]
|
||||
ISOStudioTungsten = 24,
|
||||
[Display(Name = "Other")]
|
||||
Unknown = 0, [Display(Name = "Daylight")]
|
||||
Daylight = 1, [Display(Name = "Fluorescent")]
|
||||
Fluorescent = 2, [Display(Name = "Tungsten (Incandescent)")]
|
||||
Incandescent = 3, [Display(Name = "Flash")]
|
||||
Flash = 4, [Display(Name = "Fine Weather")]
|
||||
FineWeather = 9, [Display(Name = "Cloudy")]
|
||||
Cloudy = 10, [Display(Name = "Shade")]
|
||||
Shade = 11, [Display(Name = "Daylight Fluorescent")]
|
||||
DaylightFluorescent = 12, [Display(Name = "Day White Fluorescent")]
|
||||
DayWhiteFluorescent = 13, [Display(Name = "Cool White Fluorescent")]
|
||||
CoolWhiteFluorescent = 14, [Display(Name = "White Fluorescent")]
|
||||
WhiteFluorescent = 15, [Display(Name = "Warm White Fluorescent")]
|
||||
WarmWhiteFluorescent = 16, [Display(Name = "Standard Light A")]
|
||||
StandardLightA = 17, [Display(Name = "Standard Light B")]
|
||||
StandardLightB = 18, [Display(Name = "Standard Light C")]
|
||||
StandardLightC = 19, [Display(Name = "D55")]
|
||||
D55 = 20, [Display(Name = "D65")]
|
||||
D65 = 21, [Display(Name = "D75")]
|
||||
D75 = 22, [Display(Name = "D50")]
|
||||
D50 = 23, [Display(Name = "ISO Studio Tungsten")]
|
||||
ISOStudioTungsten = 24, [Display(Name = "Other")]
|
||||
Other = 255
|
||||
}
|
||||
|
||||
public enum MeteringMode : ushort
|
||||
{
|
||||
[Display(Name = "Unknown")]
|
||||
Unknown = 0,
|
||||
[Display(Name = "Average")]
|
||||
Average = 1,
|
||||
[Display(Name = "Center-weighted average")]
|
||||
CenterWeightedAverage = 2,
|
||||
[Display(Name = "Spot")]
|
||||
Spot = 3,
|
||||
[Display(Name = "Multi-spot")]
|
||||
MultiSpot = 4,
|
||||
[Display(Name = "Multi-segment")]
|
||||
MultiSegment = 5,
|
||||
[Display(Name = "Partial")]
|
||||
Partial = 6,
|
||||
[Display(Name = "Other")]
|
||||
Unknown = 0, [Display(Name = "Average")]
|
||||
Average = 1, [Display(Name = "Center-weighted average")]
|
||||
CenterWeightedAverage = 2, [Display(Name = "Spot")]
|
||||
Spot = 3, [Display(Name = "Multi-spot")]
|
||||
MultiSpot = 4, [Display(Name = "Multi-segment")]
|
||||
MultiSegment = 5, [Display(Name = "Partial")]
|
||||
Partial = 6, [Display(Name = "Other")]
|
||||
Other = 255
|
||||
}
|
||||
|
||||
public enum Orientation : ushort
|
||||
{
|
||||
[Display(Name = "Horizontal (normal)")]
|
||||
Horizontal = 1,
|
||||
[Display(Name = "Mirror horizontal")]
|
||||
MirrorHorizontal = 2,
|
||||
[Display(Name = "Rotate 180")]
|
||||
Rotate180 = 3,
|
||||
[Display(Name = "Mirror vertical")]
|
||||
MirrorVertical = 4,
|
||||
[Display(Name = "Mirror horizontal and rotate 270 CW")]
|
||||
MirrorHorizontalAndRotate270CW = 5,
|
||||
[Display(Name = "Rotate 90 CW")]
|
||||
Rotate90CW = 6,
|
||||
[Display(Name = "Mirror horizontal and rotate 90 CW")]
|
||||
MirrorHorizontalAndRotate90CW = 7,
|
||||
[Display(Name = "Rotate 270 CW")]
|
||||
Horizontal = 1, [Display(Name = "Mirror horizontal")]
|
||||
MirrorHorizontal = 2, [Display(Name = "Rotate 180")]
|
||||
Rotate180 = 3, [Display(Name = "Mirror vertical")]
|
||||
MirrorVertical = 4, [Display(Name = "Mirror horizontal and rotate 270 CW")]
|
||||
MirrorHorizontalAndRotate270CW = 5, [Display(Name = "Rotate 90 CW")]
|
||||
Rotate90CW = 6, [Display(Name = "Mirror horizontal and rotate 90 CW")]
|
||||
MirrorHorizontalAndRotate90CW = 7, [Display(Name = "Rotate 270 CW")]
|
||||
Rotate270CW = 8
|
||||
}
|
||||
|
||||
public enum ResolutionUnit : ushort
|
||||
{
|
||||
None = 1,
|
||||
Inches = 2,
|
||||
Centimeters = 3
|
||||
None = 1, Inches = 2, Centimeters = 3
|
||||
}
|
||||
|
||||
public enum Saturation : ushort
|
||||
{
|
||||
Normal = 0,
|
||||
Low = 1,
|
||||
Hig = 2
|
||||
Normal = 0, Low = 1, Hig = 2
|
||||
}
|
||||
|
||||
public enum SceneCaptureType : ushort
|
||||
{
|
||||
Standard = 0,
|
||||
Landscape = 1,
|
||||
Portrait = 2,
|
||||
Night = 3
|
||||
Standard = 0, Landscape = 1, Portrait = 2,
|
||||
Night = 3
|
||||
}
|
||||
|
||||
public enum SensingMethod : ushort
|
||||
{
|
||||
[Display(Name = "Not defined")]
|
||||
Undefined = 1,
|
||||
[Display(Name = "One-chip color area")]
|
||||
OneChipColorArea = 2,
|
||||
[Display(Name = "Two-chip color area")]
|
||||
TwoChipColorArea = 3,
|
||||
[Display(Name = "Three-chip color area")]
|
||||
ThreeChipColorArea = 4,
|
||||
[Display(Name = "Color sequential area")]
|
||||
ColorSequentialArea = 5,
|
||||
[Display(Name = "Trilinear")]
|
||||
Trilinear = 7,
|
||||
[Display(Name = "Color sequential linear")]
|
||||
Undefined = 1, [Display(Name = "One-chip color area")]
|
||||
OneChipColorArea = 2, [Display(Name = "Two-chip color area")]
|
||||
TwoChipColorArea = 3, [Display(Name = "Three-chip color area")]
|
||||
ThreeChipColorArea = 4, [Display(Name = "Color sequential area")]
|
||||
ColorSequentialArea = 5, [Display(Name = "Trilinear")]
|
||||
Trilinear = 7, [Display(Name = "Color sequential linear")]
|
||||
ColorSequentialLinear = 8
|
||||
}
|
||||
|
||||
public enum SubjectDistanceRange : ushort
|
||||
{
|
||||
Unknown = 0,
|
||||
Macro = 1,
|
||||
Close = 2,
|
||||
Unknown = 0, Macro = 1, Close = 2,
|
||||
Distant = 3
|
||||
}
|
||||
|
||||
public enum WhiteBalance : ushort
|
||||
{
|
||||
Auto = 0,
|
||||
Manual = 1
|
||||
Auto = 0, Manual = 1
|
||||
}
|
||||
|
||||
public enum Sharpness : ushort
|
||||
{
|
||||
Normal = 0,
|
||||
Low = 1,
|
||||
Hig = 2
|
||||
Normal = 0, Low = 1, Hig = 2
|
||||
}
|
||||
}
|
||||
@@ -41,9 +41,7 @@ namespace Marechai.Database
|
||||
/// <summary>Last inserted row's ID</summary>
|
||||
long LastInsertRowId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Opens an existing database
|
||||
/// </summary>
|
||||
/// <summary>Opens an existing database</summary>
|
||||
/// <param name="server">Server</param>
|
||||
/// <param name="user">User</param>
|
||||
/// <param name="database">Database name</param>
|
||||
@@ -52,14 +50,10 @@ namespace Marechai.Database
|
||||
/// <returns><c>true</c> if database opened correctly, <c>false</c> otherwise</returns>
|
||||
bool OpenDb(string server, string user, string database, string password, ushort port);
|
||||
|
||||
/// <summary>
|
||||
/// Closes the database
|
||||
/// </summary>
|
||||
/// <summary>Closes the database</summary>
|
||||
void CloseDb();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a data adapter for the opened database
|
||||
/// </summary>
|
||||
/// <summary>Gets a data adapter for the opened database</summary>
|
||||
/// <returns>Data adapter</returns>
|
||||
IDbDataAdapter GetNewDataAdapter();
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,14 +4,8 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class BrowserTestFieldsAsBoolean : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) { }
|
||||
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
protected override void Down(MigrationBuilder migrationBuilder) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,116 +38,110 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("AspNetRoles",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<string>(nullable: false),
|
||||
Name = table.Column<string>(maxLength: 256, nullable: true),
|
||||
NormalizedName = table.Column<string>(maxLength: 256, nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(nullable: true)
|
||||
}, constraints: table => { table.PrimaryKey("PK_AspNetRoles", x => x.Id); });
|
||||
migrationBuilder.CreateTable("AspNetRoles", table => new
|
||||
{
|
||||
Id = table.Column<string>(), Name = table.Column<string>(maxLength: 256, nullable: true),
|
||||
NormalizedName = table.Column<string>(maxLength: 256, nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("AspNetUsers",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<string>(nullable: false),
|
||||
UserName =
|
||||
table.Column<string>(maxLength: 256, nullable: true),
|
||||
NormalizedUserName =
|
||||
table.Column<string>(maxLength: 256, nullable: true),
|
||||
Email =
|
||||
table.Column<string>(maxLength: 256, nullable: true),
|
||||
NormalizedEmail =
|
||||
table.Column<string>(maxLength: 256, nullable: true),
|
||||
EmailConfirmed = table.Column<bool>(nullable: false),
|
||||
PasswordHash = table.Column<string>(nullable: true),
|
||||
SecurityStamp = table.Column<string>(nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(nullable: true),
|
||||
PhoneNumber = table.Column<string>(nullable: true),
|
||||
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
|
||||
TwoFactorEnabled = table.Column<bool>(nullable: false),
|
||||
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
|
||||
LockoutEnabled = table.Column<bool>(nullable: false),
|
||||
AccessFailedCount = table.Column<int>(nullable: false)
|
||||
}, constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); });
|
||||
migrationBuilder.CreateTable("AspNetUsers", table => new
|
||||
{
|
||||
Id = table.Column<string>(),
|
||||
UserName = table.Column<string>(maxLength: 256, nullable: true),
|
||||
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
|
||||
Email = table.Column<string>(maxLength: 256, nullable: true),
|
||||
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
|
||||
EmailConfirmed = table.Column<bool>(), PasswordHash = table.Column<string>(nullable: true),
|
||||
SecurityStamp = table.Column<string>(nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(nullable: true),
|
||||
PhoneNumber = table.Column<string>(nullable: true), PhoneNumberConfirmed = table.Column<bool>(),
|
||||
TwoFactorEnabled = table.Column<bool>(),
|
||||
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
|
||||
LockoutEnabled = table.Column<bool>(), AccessFailedCount = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("AspNetRoleClaims",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
RoleId = table.Column<string>(nullable: false),
|
||||
ClaimType = table.Column<string>(nullable: true),
|
||||
ClaimValue = table.Column<string>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
|
||||
table.ForeignKey("FK_AspNetRoleClaims_AspNetRoles_RoleId", x => x.RoleId,
|
||||
"AspNetRoles", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("AspNetRoleClaims", table => new
|
||||
{
|
||||
Id = table.Column<int>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
RoleId = table.Column<string>(), ClaimType = table.Column<string>(nullable: true),
|
||||
ClaimValue = table.Column<string>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
|
||||
|
||||
migrationBuilder.CreateTable("AspNetUserClaims",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
UserId = table.Column<string>(nullable: false),
|
||||
ClaimType = table.Column<string>(nullable: true),
|
||||
ClaimValue = table.Column<string>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
|
||||
table.ForeignKey("FK_AspNetUserClaims_AspNetUsers_UserId", x => x.UserId,
|
||||
"AspNetUsers", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
table.ForeignKey("FK_AspNetRoleClaims_AspNetRoles_RoleId", x => x.RoleId, "AspNetRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("AspNetUserLogins",
|
||||
table => new
|
||||
{
|
||||
LoginProvider =
|
||||
table.Column<string>(maxLength: 128, nullable: false),
|
||||
ProviderKey =
|
||||
table.Column<string>(maxLength: 128, nullable: false),
|
||||
ProviderDisplayName = table.Column<string>(nullable: true),
|
||||
UserId = table.Column<string>(nullable: false)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserLogins",
|
||||
x => new {x.LoginProvider, x.ProviderKey});
|
||||
table.ForeignKey("FK_AspNetUserLogins_AspNetUsers_UserId", x => x.UserId,
|
||||
"AspNetUsers", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("AspNetUserClaims", table => new
|
||||
{
|
||||
Id = table.Column<int>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
UserId = table.Column<string>(), ClaimType = table.Column<string>(nullable: true),
|
||||
ClaimValue = table.Column<string>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
|
||||
|
||||
migrationBuilder.CreateTable("AspNetUserRoles",
|
||||
table => new
|
||||
{
|
||||
UserId = table.Column<string>(nullable: false),
|
||||
RoleId = table.Column<string>(nullable: false)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserRoles", x => new {x.UserId, x.RoleId});
|
||||
table.ForeignKey("FK_AspNetUserRoles_AspNetRoles_RoleId", x => x.RoleId,
|
||||
"AspNetRoles", "Id", onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_AspNetUserRoles_AspNetUsers_UserId", x => x.UserId,
|
||||
"AspNetUsers", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
table.ForeignKey("FK_AspNetUserClaims_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("AspNetUserTokens",
|
||||
table => new
|
||||
{
|
||||
UserId = table.Column<string>(nullable: false),
|
||||
LoginProvider = table.Column<string>(maxLength: 128, nullable: false),
|
||||
Name = table.Column<string>(maxLength: 128, nullable: false),
|
||||
Value = table.Column<string>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserTokens",
|
||||
x => new {x.UserId, x.LoginProvider, x.Name});
|
||||
table.ForeignKey("FK_AspNetUserTokens_AspNetUsers_UserId", x => x.UserId,
|
||||
"AspNetUsers", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("AspNetUserLogins", table => new
|
||||
{
|
||||
LoginProvider = table.Column<string>(maxLength: 128),
|
||||
ProviderKey = table.Column<string>(maxLength: 128),
|
||||
ProviderDisplayName = table.Column<string>(nullable: true), UserId = table.Column<string>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserLogins", x => new
|
||||
{
|
||||
x.LoginProvider, x.ProviderKey
|
||||
});
|
||||
|
||||
table.ForeignKey("FK_AspNetUserLogins_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("AspNetUserRoles", table => new
|
||||
{
|
||||
UserId = table.Column<string>(), RoleId = table.Column<string>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserRoles", x => new
|
||||
{
|
||||
x.UserId, x.RoleId
|
||||
});
|
||||
|
||||
table.ForeignKey("FK_AspNetUserRoles_AspNetRoles_RoleId", x => x.RoleId, "AspNetRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_AspNetUserRoles_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("AspNetUserTokens", table => new
|
||||
{
|
||||
UserId = table.Column<string>(), LoginProvider = table.Column<string>(maxLength: 128),
|
||||
Name = table.Column<string>(maxLength: 128), Value = table.Column<string>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserTokens", x => new
|
||||
{
|
||||
x.UserId, x.LoginProvider, x.Name
|
||||
});
|
||||
|
||||
table.ForeignKey("FK_AspNetUserTokens_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_AspNetRoleClaims_RoleId", "AspNetRoleClaims", "RoleId");
|
||||
|
||||
|
||||
@@ -5,27 +5,21 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class RemoveCompanyDescriptions : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("company_descriptions");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("company_descriptions",
|
||||
table => new
|
||||
{
|
||||
id = table.Column<int>("int(11)")
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
company_id = table.Column<int>("int(11)"),
|
||||
text = table.Column<string>("text", nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_company_descriptions", x => x.id);
|
||||
table.ForeignKey("fk_company_id", x => x.id, "companies", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("company_descriptions", table => new
|
||||
{
|
||||
id = table.Column<int>("int(11)").
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
company_id = table.Column<int>("int(11)"), text = table.Column<string>("text", nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_company_descriptions", x => x.id);
|
||||
table.ForeignKey("fk_company_id", x => x.id, "companies", "id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("idx_company_id", "company_descriptions", "company_id", unique: true);
|
||||
|
||||
|
||||
@@ -7,28 +7,23 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("CompanyDescriptions",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CompanyId = table.Column<int>(),
|
||||
Text = table.Column<string>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CompanyDescriptions", x => x.Id);
|
||||
table.ForeignKey("FK_CompanyDescriptions_companies_CompanyId",
|
||||
x => x.CompanyId, "companies", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("CompanyDescriptions", table => new
|
||||
{
|
||||
Id = table.Column<int>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CompanyId = table.Column<int>(), Text = table.Column<string>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CompanyDescriptions", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_CompanyDescriptions_companies_CompanyId", x => x.CompanyId, "companies", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_CompanyDescriptions_CompanyId", "CompanyDescriptions", "CompanyId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("CompanyDescriptions");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@ namespace Marechai.Database.Migrations
|
||||
migrationBuilder.AlterColumn<string>("Text", "CompanyDescriptions", nullable: true,
|
||||
oldClrType: typeof(string), oldNullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex("IX_CompanyDescriptions_Text", "CompanyDescriptions", "Text")
|
||||
.Annotation("MySql:FullTextIndex", true);
|
||||
migrationBuilder.CreateIndex("IX_CompanyDescriptions_Text", "CompanyDescriptions", "Text").
|
||||
Annotation("MySql:FullTextIndex", true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
|
||||
@@ -4,16 +4,12 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class AnnotateCompanyDescription : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AlterColumn<string>("Text", "CompanyDescriptions", maxLength: 262144, nullable: true,
|
||||
oldClrType: typeof(string), oldNullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AlterColumn<string>("Text", "CompanyDescriptions", nullable: true,
|
||||
oldClrType: typeof(string), oldMaxLength: 262144, oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,10 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class AddPreRenderedCompanyDescription : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AddColumn<string>("Html", "CompanyDescriptions", maxLength: 262144, nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropColumn("Html", "CompanyDescriptions");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,13 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class NewsDateAsDateTime : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AlterColumn<DateTime>("date", "news", "datetime", nullable: false,
|
||||
oldClrType: typeof(string), oldType: "char(20)",
|
||||
oldDefaultValueSql: "''");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AlterColumn<string>("date", "news", "char(20)", nullable: false, defaultValueSql: "''",
|
||||
oldClrType: typeof(DateTime), oldType: "datetime");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,25 +5,20 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class DropOldAdminsTable : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("admins");
|
||||
}
|
||||
protected override void Up(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("admins");
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("admins",
|
||||
table => new
|
||||
{
|
||||
id = table.Column<int>("int(11)")
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
password =
|
||||
table.Column<string>("char(50)", nullable: false,
|
||||
defaultValueSql: "''"),
|
||||
user = table.Column<string>("char(50)", nullable: false,
|
||||
defaultValueSql: "''")
|
||||
}, constraints: table => { table.PrimaryKey("PK_admins", x => x.id); });
|
||||
migrationBuilder.CreateTable("admins", table => new
|
||||
{
|
||||
id = table.Column<int>("int(11)").
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
password = table.Column<string>("char(50)", nullable: false, defaultValueSql: "''"),
|
||||
user = table.Column<string>("char(50)", nullable: false, defaultValueSql: "''")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_admins", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("idx_admins_user", "admins", "user");
|
||||
}
|
||||
|
||||
@@ -4,14 +4,10 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class GrayscaleResolutions : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AddColumn<bool>("Grayscale", "resolutions", nullable: false, defaultValue: false);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropColumn("Grayscale", "resolutions");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,27 +4,12 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class DataAnnotations : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Text",
|
||||
table: "CompanyDescriptions",
|
||||
maxLength: 262144,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldMaxLength: 262144,
|
||||
oldNullable: true);
|
||||
}
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AlterColumn<string>("Text", "CompanyDescriptions", maxLength: 262144, nullable: false,
|
||||
oldClrType: typeof(string), oldMaxLength: 262144, oldNullable: true);
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Text",
|
||||
table: "CompanyDescriptions",
|
||||
maxLength: 262144,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldMaxLength: 262144);
|
||||
}
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AlterColumn<string>("Text", "CompanyDescriptions", maxLength: 262144, nullable: true,
|
||||
oldClrType: typeof(string), oldMaxLength: 262144);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,57 +10,56 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
migrationBuilder.AddColumn<string>("Discriminator", "AspNetUsers", nullable: false, defaultValue: "");
|
||||
|
||||
migrationBuilder.CreateTable("MachinePhotos",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<Guid>(),
|
||||
Author = table.Column<string>(nullable: true),
|
||||
CameraManufacturer = table.Column<string>(nullable: true),
|
||||
CameraModel = table.Column<string>(nullable: true),
|
||||
ColorSpace = table.Column<string>(nullable: true),
|
||||
Comments = table.Column<string>(nullable: true),
|
||||
Contrast = table.Column<string>(nullable: true),
|
||||
CreationDate = table.Column<DateTime>(nullable: true),
|
||||
DigitalZoomRatio = table.Column<double>(nullable: true),
|
||||
ExifVersion = table.Column<string>(nullable: true),
|
||||
Exposure = table.Column<double>(nullable: true),
|
||||
ExposureMethod = table.Column<string>(nullable: true),
|
||||
ExposureProgram = table.Column<string>(nullable: true),
|
||||
Flash = table.Column<string>(nullable: true),
|
||||
Focal = table.Column<int>(nullable: true),
|
||||
FocalLength = table.Column<int>(nullable: true),
|
||||
FocalLengthEquivalent = table.Column<string>(nullable: true),
|
||||
HorizontalResolution = table.Column<int>(nullable: true),
|
||||
IsoRating = table.Column<int>(nullable: true),
|
||||
Lens = table.Column<string>(nullable: true),
|
||||
License = table.Column<string>(nullable: true),
|
||||
LightSource = table.Column<string>(nullable: true),
|
||||
MeteringMode = table.Column<string>(nullable: true),
|
||||
Orientation = table.Column<string>(nullable: true),
|
||||
PixelComposition = table.Column<string>(nullable: true),
|
||||
Saturation = table.Column<string>(nullable: true),
|
||||
SceneCaptureType = table.Column<string>(nullable: true),
|
||||
SceneControl = table.Column<string>(nullable: true),
|
||||
SensingMethod = table.Column<string>(nullable: true),
|
||||
Sharpness = table.Column<string>(nullable: true),
|
||||
SoftwareUsed = table.Column<string>(nullable: true),
|
||||
SubjectDistanceRange = table.Column<string>(nullable: true),
|
||||
UploadDate =
|
||||
table.Column<DateTime>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.ComputedColumn),
|
||||
VerticalResolution = table.Column<int>(nullable: true),
|
||||
WhiteBalance = table.Column<string>(nullable: true),
|
||||
UserId = table.Column<string>(nullable: true),
|
||||
MachineId = table.Column<int>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MachinePhotos", x => x.Id);
|
||||
table.ForeignKey("FK_MachinePhotos_machines_MachineId", x => x.MachineId,
|
||||
"machines", "id", onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_MachinePhotos_AspNetUsers_UserId", x => x.UserId,
|
||||
"AspNetUsers", "Id", onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
migrationBuilder.CreateTable("MachinePhotos", table => new
|
||||
{
|
||||
Id = table.Column<Guid>(), Author = table.Column<string>(nullable: true),
|
||||
CameraManufacturer = table.Column<string>(nullable: true),
|
||||
CameraModel = table.Column<string>(nullable: true),
|
||||
ColorSpace = table.Column<string>(nullable: true),
|
||||
Comments = table.Column<string>(nullable: true),
|
||||
Contrast = table.Column<string>(nullable: true),
|
||||
CreationDate = table.Column<DateTime>(nullable: true),
|
||||
DigitalZoomRatio = table.Column<double>(nullable: true),
|
||||
ExifVersion = table.Column<string>(nullable: true),
|
||||
Exposure = table.Column<double>(nullable: true),
|
||||
ExposureMethod = table.Column<string>(nullable: true),
|
||||
ExposureProgram = table.Column<string>(nullable: true),
|
||||
Flash = table.Column<string>(nullable: true),
|
||||
Focal = table.Column<int>(nullable: true),
|
||||
FocalLength = table.Column<int>(nullable: true),
|
||||
FocalLengthEquivalent = table.Column<string>(nullable: true),
|
||||
HorizontalResolution = table.Column<int>(nullable: true),
|
||||
IsoRating = table.Column<int>(nullable: true),
|
||||
Lens = table.Column<string>(nullable: true),
|
||||
License = table.Column<string>(nullable: true),
|
||||
LightSource = table.Column<string>(nullable: true),
|
||||
MeteringMode = table.Column<string>(nullable: true),
|
||||
Orientation = table.Column<string>(nullable: true),
|
||||
PixelComposition = table.Column<string>(nullable: true),
|
||||
Saturation = table.Column<string>(nullable: true),
|
||||
SceneCaptureType = table.Column<string>(nullable: true),
|
||||
SceneControl = table.Column<string>(nullable: true),
|
||||
SensingMethod = table.Column<string>(nullable: true),
|
||||
Sharpness = table.Column<string>(nullable: true),
|
||||
SoftwareUsed = table.Column<string>(nullable: true),
|
||||
SubjectDistanceRange = table.Column<string>(nullable: true),
|
||||
UploadDate = table.Column<DateTime>().
|
||||
Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.ComputedColumn),
|
||||
VerticalResolution = table.Column<int>(nullable: true),
|
||||
WhiteBalance = table.Column<string>(nullable: true),
|
||||
UserId = table.Column<string>(nullable: true),
|
||||
MachineId = table.Column<int>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MachinePhotos", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_MachinePhotos_machines_MachineId", x => x.MachineId, "machines", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_MachinePhotos_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MachinePhotos_Author", "MachinePhotos", "Author");
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,15 +4,11 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class MachinePhotoForeignKeys : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AlterColumn<int>("MachineId", "MachinePhotos", nullable: false, oldClrType: typeof(int),
|
||||
oldNullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AlterColumn<int>("MachineId", "MachinePhotos", nullable: true, oldClrType: typeof(int));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,16 +4,12 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class ChangeMachinePhotoSharpnessTypeToExifType : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AlterColumn<ushort>("Sharpness", "MachinePhotos", nullable: true,
|
||||
oldClrType: typeof(string), oldNullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AlterColumn<string>("Sharpness", "MachinePhotos", nullable: true,
|
||||
oldClrType: typeof(ushort), oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,10 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class AddMachinePhotoSourceUrl : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AddColumn<string>("Source", "MachinePhotos", nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropColumn("Source", "MachinePhotos");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,183 +8,155 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("OwnedMachines",
|
||||
table => new
|
||||
{
|
||||
Id =
|
||||
table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
AcquisitionDate = table.Column<DateTime>(),
|
||||
LostDate = table.Column<DateTime>(nullable: true),
|
||||
Status = table.Column<int>(),
|
||||
LastStatusDate = table.Column<DateTime>(nullable: true),
|
||||
Trade = table.Column<bool>(),
|
||||
Boxed = table.Column<bool>(),
|
||||
Manuals = table.Column<bool>(),
|
||||
SerialNumber = table.Column<string>(nullable: true),
|
||||
SerialNumberVisible =
|
||||
table.Column<bool>(nullable: false, defaultValue: true),
|
||||
MachineId = table.Column<int>(),
|
||||
UserId = table.Column<string>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OwnedMachines", x => x.Id);
|
||||
table.ForeignKey("FK_OwnedMachines_machines_MachineId", x => x.MachineId,
|
||||
"machines", "id", onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_OwnedMachines_AspNetUsers_UserId", x => x.UserId,
|
||||
"AspNetUsers", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("OwnedMachines", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
AcquisitionDate = table.Column<DateTime>(), LostDate = table.Column<DateTime>(nullable: true),
|
||||
Status = table.Column<int>(), LastStatusDate = table.Column<DateTime>(nullable: true),
|
||||
Trade = table.Column<bool>(), Boxed = table.Column<bool>(),
|
||||
Manuals = table.Column<bool>(),
|
||||
SerialNumber = table.Column<string>(nullable: true),
|
||||
SerialNumberVisible = table.Column<bool>(nullable: false, defaultValue: true),
|
||||
MachineId = table.Column<int>(), UserId = table.Column<string>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OwnedMachines", x => x.Id);
|
||||
|
||||
migrationBuilder.CreateTable("GpusByOwnedMachine",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
GpuId = table.Column<int>(),
|
||||
OwnedMachineId = table.Column<long>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GpusByOwnedMachine", x => x.Id);
|
||||
table.ForeignKey("FK_GpusByOwnedMachine_gpus_GpuId", x => x.GpuId, "gpus",
|
||||
"id", onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_GpusByOwnedMachine_OwnedMachines_OwnedMachineId",
|
||||
x => x.OwnedMachineId, "OwnedMachines", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
table.ForeignKey("FK_OwnedMachines_machines_MachineId", x => x.MachineId, "machines", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.CreateTable("MemoryByOwnedMachine",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
OwnedMachineId = table.Column<long>(),
|
||||
Type = table.Column<int>(),
|
||||
Usage = table.Column<int>(),
|
||||
Size = table.Column<long>(),
|
||||
Speed = table.Column<double>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MemoryByOwnedMachine", x => x.Id);
|
||||
table.ForeignKey("FK_MemoryByOwnedMachine_OwnedMachines_OwnedMachineId",
|
||||
x => x.OwnedMachineId, "OwnedMachines", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
table.ForeignKey("FK_OwnedMachines_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("OwnedMachinePhotos",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<Guid>(),
|
||||
Author = table.Column<string>(nullable: true),
|
||||
CameraManufacturer = table.Column<string>(nullable: true),
|
||||
CameraModel = table.Column<string>(nullable: true),
|
||||
ColorSpace = table.Column<ushort>(nullable: true),
|
||||
Comments = table.Column<string>(nullable: true),
|
||||
Contrast = table.Column<ushort>(nullable: true),
|
||||
CreationDate = table.Column<DateTime>(nullable: true),
|
||||
DigitalZoomRatio = table.Column<double>(nullable: true),
|
||||
ExifVersion = table.Column<string>(nullable: true),
|
||||
Exposure = table.Column<string>(nullable: true),
|
||||
ExposureMethod = table.Column<ushort>(nullable: true),
|
||||
ExposureProgram = table.Column<ushort>(nullable: true),
|
||||
Flash = table.Column<ushort>(nullable: true),
|
||||
Focal = table.Column<double>(nullable: true),
|
||||
FocalLength = table.Column<double>(nullable: true),
|
||||
FocalLengthEquivalent = table.Column<ushort>(nullable: true),
|
||||
HorizontalResolution = table.Column<double>(nullable: true),
|
||||
IsoRating = table.Column<ushort>(nullable: true),
|
||||
Lens = table.Column<string>(nullable: true),
|
||||
LightSource = table.Column<ushort>(nullable: true),
|
||||
MeteringMode = table.Column<ushort>(nullable: true),
|
||||
ResolutionUnit = table.Column<ushort>(nullable: true),
|
||||
Orientation = table.Column<ushort>(nullable: true),
|
||||
Saturation = table.Column<ushort>(nullable: true),
|
||||
SceneCaptureType = table.Column<ushort>(nullable: true),
|
||||
SensingMethod = table.Column<ushort>(nullable: true),
|
||||
Sharpness = table.Column<ushort>(nullable: true),
|
||||
SoftwareUsed = table.Column<string>(nullable: true),
|
||||
SubjectDistanceRange = table.Column<ushort>(nullable: true),
|
||||
UploadDate =
|
||||
table.Column<DateTime>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.ComputedColumn),
|
||||
VerticalResolution = table.Column<double>(nullable: true),
|
||||
WhiteBalance = table.Column<ushort>(nullable: true),
|
||||
UserId = table.Column<string>(nullable: true),
|
||||
LicenseId = table.Column<int>(),
|
||||
OwnedMachineId = table.Column<long>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OwnedMachinePhotos", x => x.Id);
|
||||
table.ForeignKey("FK_OwnedMachinePhotos_Licenses_LicenseId",
|
||||
x => x.LicenseId, "Licenses", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_OwnedMachinePhotos_OwnedMachines_OwnedMachineId",
|
||||
x => x.OwnedMachineId, "OwnedMachines", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_OwnedMachinePhotos_AspNetUsers_UserId", x => x.UserId,
|
||||
"AspNetUsers", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("GpusByOwnedMachine", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
GpuId = table.Column<int>(), OwnedMachineId = table.Column<long>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GpusByOwnedMachine", x => x.Id);
|
||||
|
||||
migrationBuilder.CreateTable("ProcessorsByOwnedMachine",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ProcessorId = table.Column<int>(),
|
||||
OwnedMachineId = table.Column<long>(),
|
||||
Speed = table.Column<float>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProcessorsByOwnedMachine", x => x.Id);
|
||||
table
|
||||
.ForeignKey("FK_ProcessorsByOwnedMachine_OwnedMachines_OwnedMachineId",
|
||||
x => x.OwnedMachineId, "OwnedMachines", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_ProcessorsByOwnedMachine_processors_ProcessorId",
|
||||
x => x.ProcessorId, "processors", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
table.ForeignKey("FK_GpusByOwnedMachine_gpus_GpuId", x => x.GpuId, "gpus", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.CreateTable("SoundByOwnedMachine",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
SoundSynthId = table.Column<int>(),
|
||||
OwnedMachineId = table.Column<long>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SoundByOwnedMachine", x => x.Id);
|
||||
table.ForeignKey("FK_SoundByOwnedMachine_OwnedMachines_OwnedMachineId",
|
||||
x => x.OwnedMachineId, "OwnedMachines", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_SoundByOwnedMachine_sound_synths_SoundSynthId",
|
||||
x => x.SoundSynthId, "sound_synths", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
table.ForeignKey("FK_GpusByOwnedMachine_OwnedMachines_OwnedMachineId", x => x.OwnedMachineId,
|
||||
"OwnedMachines", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("StorageByOwnedMachine",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
OwnedMachineId = table.Column<long>(),
|
||||
Type = table.Column<int>(),
|
||||
Interface = table.Column<int>(),
|
||||
Capacity = table.Column<long>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_StorageByOwnedMachine", x => x.Id);
|
||||
table.ForeignKey("FK_StorageByOwnedMachine_OwnedMachines_OwnedMachineId",
|
||||
x => x.OwnedMachineId, "OwnedMachines", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("MemoryByOwnedMachine", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
OwnedMachineId = table.Column<long>(), Type = table.Column<int>(), Usage = table.Column<int>(),
|
||||
Size = table.Column<long>(), Speed = table.Column<double>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MemoryByOwnedMachine", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_MemoryByOwnedMachine_OwnedMachines_OwnedMachineId", x => x.OwnedMachineId,
|
||||
"OwnedMachines", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("OwnedMachinePhotos", table => new
|
||||
{
|
||||
Id = table.Column<Guid>(), Author = table.Column<string>(nullable: true),
|
||||
CameraManufacturer = table.Column<string>(nullable: true),
|
||||
CameraModel = table.Column<string>(nullable: true),
|
||||
ColorSpace = table.Column<ushort>(nullable: true),
|
||||
Comments = table.Column<string>(nullable: true),
|
||||
Contrast = table.Column<ushort>(nullable: true),
|
||||
CreationDate = table.Column<DateTime>(nullable: true),
|
||||
DigitalZoomRatio = table.Column<double>(nullable: true),
|
||||
ExifVersion = table.Column<string>(nullable: true),
|
||||
Exposure = table.Column<string>(nullable: true),
|
||||
ExposureMethod = table.Column<ushort>(nullable: true),
|
||||
ExposureProgram = table.Column<ushort>(nullable: true),
|
||||
Flash = table.Column<ushort>(nullable: true),
|
||||
Focal = table.Column<double>(nullable: true),
|
||||
FocalLength = table.Column<double>(nullable: true),
|
||||
FocalLengthEquivalent = table.Column<ushort>(nullable: true),
|
||||
HorizontalResolution = table.Column<double>(nullable: true),
|
||||
IsoRating = table.Column<ushort>(nullable: true),
|
||||
Lens = table.Column<string>(nullable: true),
|
||||
LightSource = table.Column<ushort>(nullable: true),
|
||||
MeteringMode = table.Column<ushort>(nullable: true),
|
||||
ResolutionUnit = table.Column<ushort>(nullable: true),
|
||||
Orientation = table.Column<ushort>(nullable: true),
|
||||
Saturation = table.Column<ushort>(nullable: true),
|
||||
SceneCaptureType = table.Column<ushort>(nullable: true),
|
||||
SensingMethod = table.Column<ushort>(nullable: true),
|
||||
Sharpness = table.Column<ushort>(nullable: true),
|
||||
SoftwareUsed = table.Column<string>(nullable: true),
|
||||
SubjectDistanceRange = table.Column<ushort>(nullable: true),
|
||||
UploadDate = table.Column<DateTime>().
|
||||
Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.ComputedColumn),
|
||||
VerticalResolution = table.Column<double>(nullable: true),
|
||||
WhiteBalance = table.Column<ushort>(nullable: true),
|
||||
UserId = table.Column<string>(nullable: true),
|
||||
LicenseId = table.Column<int>(), OwnedMachineId = table.Column<long>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OwnedMachinePhotos", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_OwnedMachinePhotos_Licenses_LicenseId", x => x.LicenseId, "Licenses", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_OwnedMachinePhotos_OwnedMachines_OwnedMachineId", x => x.OwnedMachineId,
|
||||
"OwnedMachines", "Id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_OwnedMachinePhotos_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("ProcessorsByOwnedMachine", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ProcessorId = table.Column<int>(), OwnedMachineId = table.Column<long>(), Speed = table.Column<float>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProcessorsByOwnedMachine", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_ProcessorsByOwnedMachine_OwnedMachines_OwnedMachineId", x => x.OwnedMachineId,
|
||||
"OwnedMachines", "Id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_ProcessorsByOwnedMachine_processors_ProcessorId", x => x.ProcessorId, "processors",
|
||||
"id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("SoundByOwnedMachine", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
SoundSynthId = table.Column<int>(), OwnedMachineId = table.Column<long>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SoundByOwnedMachine", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_SoundByOwnedMachine_OwnedMachines_OwnedMachineId", x => x.OwnedMachineId,
|
||||
"OwnedMachines", "Id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_SoundByOwnedMachine_sound_synths_SoundSynthId", x => x.SoundSynthId,
|
||||
"sound_synths", "id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("StorageByOwnedMachine", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
OwnedMachineId = table.Column<long>(), Type = table.Column<int>(), Interface = table.Column<int>(),
|
||||
Capacity = table.Column<long>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_StorageByOwnedMachine", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_StorageByOwnedMachine_OwnedMachines_OwnedMachineId", x => x.OwnedMachineId,
|
||||
"OwnedMachines", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_GpusByOwnedMachine_GpuId", "GpusByOwnedMachine", "GpuId");
|
||||
|
||||
@@ -357,91 +329,46 @@ SELECT a.date, a.status, a.trade, a.boxed, a.manuals, a.db_id + 356, @userId FRO
|
||||
|
||||
migrationBuilder.DropTable("OwnedMachines");
|
||||
|
||||
migrationBuilder.CreateTable("owned_computers",
|
||||
table => new
|
||||
{
|
||||
id =
|
||||
table.Column<int>("int(11)")
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
boxed =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
cap1 =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
cap2 =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
cpu1 =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
cpu2 =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
date =
|
||||
table.Column<string>("varchar(20)", nullable: false,
|
||||
defaultValueSql: "''"),
|
||||
db_id =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
disk1 =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
disk2 =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
manuals =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
mhz1 =
|
||||
table.Column<decimal>("decimal(10,0)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
mhz2 =
|
||||
table.Column<decimal>("decimal(10,0)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
ram =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
rigid =
|
||||
table.Column<string>("varchar(64)", nullable: false,
|
||||
defaultValueSql: "''"),
|
||||
status =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
trade = table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
vram = table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'")
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_owned_computers", x => x.id); });
|
||||
migrationBuilder.CreateTable("owned_computers", table => new
|
||||
{
|
||||
id = table.Column<int>("int(11)").
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
boxed = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
cap1 = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
cap2 = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
cpu1 = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
cpu2 = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
date = table.Column<string>("varchar(20)", nullable: false, defaultValueSql: "''"),
|
||||
db_id = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
disk1 = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
disk2 = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
manuals = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
mhz1 = table.Column<decimal>("decimal(10,0)", nullable: false, defaultValueSql: "'0'"),
|
||||
mhz2 = table.Column<decimal>("decimal(10,0)", nullable: false, defaultValueSql: "'0'"),
|
||||
ram = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
rigid = table.Column<string>("varchar(64)", nullable: false, defaultValueSql: "''"),
|
||||
status = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
trade = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
vram = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_owned_computers", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("owned_consoles",
|
||||
table => new
|
||||
{
|
||||
id =
|
||||
table.Column<int>("int(11)")
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
boxed =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
date =
|
||||
table.Column<string>("char(20)", nullable: false,
|
||||
defaultValueSql: "''"),
|
||||
db_id =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
manuals =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
status =
|
||||
table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'"),
|
||||
trade = table.Column<int>("int(11)", nullable: false,
|
||||
defaultValueSql: "'0'")
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_owned_consoles", x => x.id); });
|
||||
migrationBuilder.CreateTable("owned_consoles", table => new
|
||||
{
|
||||
id = table.Column<int>("int(11)").
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
boxed = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
date = table.Column<string>("char(20)", nullable: false, defaultValueSql: "''"),
|
||||
db_id = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
manuals = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
status = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'"),
|
||||
trade = table.Column<int>("int(11)", nullable: false, defaultValueSql: "'0'")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_owned_consoles", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("idx_owned_computers_boxed", "owned_computers", "boxed");
|
||||
|
||||
|
||||
@@ -7,62 +7,52 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("Screens",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Width = table.Column<double>(nullable: true),
|
||||
Height = table.Column<double>(nullable: true),
|
||||
Diagonal = table.Column<double>(),
|
||||
NativeResolutionId = table.Column<int>(),
|
||||
EffectiveColors = table.Column<long>(nullable: true),
|
||||
Type = table.Column<string>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Screens", x => x.Id);
|
||||
table.ForeignKey("FK_Screens_resolutions_NativeResolutionId",
|
||||
x => x.NativeResolutionId, "resolutions", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("Screens", table => new
|
||||
{
|
||||
Id = table.Column<int>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Width = table.Column<double>(nullable: true), Height = table.Column<double>(nullable: true),
|
||||
Diagonal = table.Column<double>(), NativeResolutionId = table.Column<int>(),
|
||||
EffectiveColors = table.Column<long>(nullable: true), Type = table.Column<string>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Screens", x => x.Id);
|
||||
|
||||
migrationBuilder.CreateTable("ResolutionsByScreen",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ScreenId = table.Column<int>(),
|
||||
ResolutionId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ResolutionsByScreen", x => x.Id);
|
||||
table.ForeignKey("FK_ResolutionsByScreen_resolutions_ResolutionId",
|
||||
x => x.ResolutionId, "resolutions", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_ResolutionsByScreen_Screens_ScreenId",
|
||||
x => x.ScreenId, "Screens", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
table.ForeignKey("FK_Screens_resolutions_NativeResolutionId", x => x.NativeResolutionId, "resolutions",
|
||||
"id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("ScreensByMachine",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ScreenId = table.Column<int>(),
|
||||
MachineId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ScreensByMachine", x => x.Id);
|
||||
table.ForeignKey("FK_ScreensByMachine_machines_MachineId",
|
||||
x => x.MachineId, "machines", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_ScreensByMachine_Screens_ScreenId", x => x.ScreenId,
|
||||
"Screens", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("ResolutionsByScreen", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ScreenId = table.Column<int>(), ResolutionId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ResolutionsByScreen", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_ResolutionsByScreen_resolutions_ResolutionId", x => x.ResolutionId, "resolutions",
|
||||
"id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_ResolutionsByScreen_Screens_ScreenId", x => x.ScreenId, "Screens", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable("ScreensByMachine", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ScreenId = table.Column<int>(), MachineId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ScreensByMachine", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_ScreensByMachine_machines_MachineId", x => x.MachineId, "machines", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_ScreensByMachine_Screens_ScreenId", x => x.ScreenId, "Screens", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_ResolutionsByScreen_ResolutionId", "ResolutionsByScreen", "ResolutionId");
|
||||
|
||||
|
||||
@@ -8,28 +8,22 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("People",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(),
|
||||
Surname = table.Column<string>(),
|
||||
BirthDate = table.Column<DateTime>(),
|
||||
DeathDate = table.Column<DateTime>(nullable: true),
|
||||
Webpage = table.Column<string>(nullable: true),
|
||||
Twitter = table.Column<string>(nullable: true),
|
||||
Facebook = table.Column<string>(nullable: true),
|
||||
Photo = table.Column<Guid>(),
|
||||
CountryOfBirthId = table.Column<short>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_People", x => x.Id);
|
||||
table.ForeignKey("FK_People_iso3166_1_numeric_CountryOfBirthId",
|
||||
x => x.CountryOfBirthId, "iso3166_1_numeric", "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
migrationBuilder.CreateTable("People", table => new
|
||||
{
|
||||
Id = table.Column<int>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(), Surname = table.Column<string>(),
|
||||
BirthDate = table.Column<DateTime>(),
|
||||
DeathDate = table.Column<DateTime>(nullable: true), Webpage = table.Column<string>(nullable: true),
|
||||
Twitter = table.Column<string>(nullable: true), Facebook = table.Column<string>(nullable: true),
|
||||
Photo = table.Column<Guid>(), CountryOfBirthId = table.Column<short>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_People", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_People_iso3166_1_numeric_CountryOfBirthId", x => x.CountryOfBirthId,
|
||||
"iso3166_1_numeric", "id", onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_People_BirthDate", "People", "BirthDate");
|
||||
|
||||
@@ -50,9 +44,6 @@ namespace Marechai.Database.Migrations
|
||||
migrationBuilder.CreateIndex("IX_People_Webpage", "People", "Webpage");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("People");
|
||||
}
|
||||
protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("People");
|
||||
}
|
||||
}
|
||||
@@ -6,18 +6,17 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("ISO_639-3",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<string>("char(3)"),
|
||||
Part2B = table.Column<string>("char(3)", nullable: true),
|
||||
Part2T = table.Column<string>("char(3)", nullable: true),
|
||||
Part1 = table.Column<string>("char(2)", nullable: true),
|
||||
Scope = table.Column<string>("char(1)"),
|
||||
Type = table.Column<string>("char(1)"),
|
||||
Ref_Name = table.Column<string>("varchar(150)"),
|
||||
Comment = table.Column<string>("varchar(150)", nullable: true)
|
||||
}, constraints: table => { table.PrimaryKey("PK_ISO_639-3", x => x.Id); });
|
||||
migrationBuilder.CreateTable("ISO_639-3", table => new
|
||||
{
|
||||
Id = table.Column<string>("char(3)"), Part2B = table.Column<string>("char(3)", nullable: true),
|
||||
Part2T = table.Column<string>("char(3)", nullable: true),
|
||||
Part1 = table.Column<string>("char(2)", nullable: true), Scope = table.Column<string>("char(1)"),
|
||||
Type = table.Column<string>("char(1)"), Ref_Name = table.Column<string>("varchar(150)"),
|
||||
Comment = table.Column<string>("varchar(150)", nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ISO_639-3", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_ISO_639-3_Comment", "ISO_639-3", "Comment");
|
||||
|
||||
@@ -34,9 +33,6 @@ namespace Marechai.Database.Migrations
|
||||
migrationBuilder.CreateIndex("IX_ISO_639-3_Type", "ISO_639-3", "Type");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("ISO_639-3");
|
||||
}
|
||||
protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("ISO_639-3");
|
||||
}
|
||||
}
|
||||
@@ -8,66 +8,36 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PeopleByCompany",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
PersonId = table.Column<int>(nullable: false),
|
||||
CompanyId = table.Column<int>(nullable: false),
|
||||
Position = table.Column<string>(nullable: true),
|
||||
Start = table.Column<DateTime>(nullable: true),
|
||||
End = table.Column<DateTime>(nullable: true),
|
||||
Ongoing = table.Column<bool>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PeopleByCompany", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PeopleByCompany_companies_CompanyId",
|
||||
column: x => x.CompanyId,
|
||||
principalTable: "companies",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PeopleByCompany_People_PersonId",
|
||||
column: x => x.PersonId,
|
||||
principalTable: "People",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("PeopleByCompany", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
PersonId = table.Column<int>(), CompanyId = table.Column<int>(),
|
||||
Position = table.Column<string>(nullable: true), Start = table.Column<DateTime>(nullable: true),
|
||||
End = table.Column<DateTime>(nullable: true), Ongoing = table.Column<bool>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PeopleByCompany", x => x.Id);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PeopleByCompany_CompanyId",
|
||||
table: "PeopleByCompany",
|
||||
column: "CompanyId");
|
||||
table.ForeignKey("FK_PeopleByCompany_companies_CompanyId", x => x.CompanyId, "companies", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PeopleByCompany_End",
|
||||
table: "PeopleByCompany",
|
||||
column: "End");
|
||||
table.ForeignKey("FK_PeopleByCompany_People_PersonId", x => x.PersonId, "People", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PeopleByCompany_PersonId",
|
||||
table: "PeopleByCompany",
|
||||
column: "PersonId");
|
||||
migrationBuilder.CreateIndex("IX_PeopleByCompany_CompanyId", "PeopleByCompany", "CompanyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PeopleByCompany_Position",
|
||||
table: "PeopleByCompany",
|
||||
column: "Position");
|
||||
migrationBuilder.CreateIndex("IX_PeopleByCompany_End", "PeopleByCompany", "End");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PeopleByCompany_Start",
|
||||
table: "PeopleByCompany",
|
||||
column: "Start");
|
||||
migrationBuilder.CreateIndex("IX_PeopleByCompany_PersonId", "PeopleByCompany", "PersonId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_PeopleByCompany_Position", "PeopleByCompany", "Position");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_PeopleByCompany_Start", "PeopleByCompany", "Start");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "PeopleByCompany");
|
||||
}
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("PeopleByCompany");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,24 +8,20 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("Documents",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Title = table.Column<string>(),
|
||||
NativeTitle = table.Column<string>(nullable: true),
|
||||
Published = table.Column<DateTime>(nullable: true),
|
||||
CountryId = table.Column<short>(nullable: true),
|
||||
Synopsis = table.Column<string>(maxLength: 262144, nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Documents", x => x.Id);
|
||||
table.ForeignKey("FK_Documents_iso3166_1_numeric_CountryId",
|
||||
x => x.CountryId, "iso3166_1_numeric", "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
migrationBuilder.CreateTable("Documents", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Title = table.Column<string>(), NativeTitle = table.Column<string>(nullable: true),
|
||||
Published = table.Column<DateTime>(nullable: true), CountryId = table.Column<short>(nullable: true),
|
||||
Synopsis = table.Column<string>(maxLength: 262144, nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Documents", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_Documents_iso3166_1_numeric_CountryId", x => x.CountryId, "iso3166_1_numeric",
|
||||
"id", onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Documents_CountryId", "Documents", "CountryId");
|
||||
|
||||
@@ -33,15 +29,12 @@ namespace Marechai.Database.Migrations
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Documents_Published", "Documents", "Published");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Documents_Synopsis", "Documents", "Synopsis")
|
||||
.Annotation("MySql:FullTextIndex", true);
|
||||
migrationBuilder.CreateIndex("IX_Documents_Synopsis", "Documents", "Synopsis").
|
||||
Annotation("MySql:FullTextIndex", true);
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Documents_Title", "Documents", "Title");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("Documents");
|
||||
}
|
||||
protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("Documents");
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,21 +9,19 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
migrationBuilder.AddColumn<int>("DocumentPersonId", "People", nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable("DocumentPeople",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(),
|
||||
Surname = table.Column<string>(),
|
||||
PersonId = table.Column<int>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DocumentPeople", x => x.Id);
|
||||
table.ForeignKey("FK_DocumentPeople_People_PersonId", x => x.PersonId,
|
||||
"People", "Id", onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
migrationBuilder.CreateTable("DocumentPeople", table => new
|
||||
{
|
||||
Id = table.Column<int>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(), Surname = table.Column<string>(),
|
||||
PersonId = table.Column<int>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DocumentPeople", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_DocumentPeople_People_PersonId", x => x.PersonId, "People", "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_DocumentPeople_Name", "DocumentPeople", "Name");
|
||||
|
||||
|
||||
@@ -7,28 +7,25 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("PeopleByDocuments",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
PersonId = table.Column<int>(),
|
||||
DocumentId = table.Column<long>(),
|
||||
RoleId = table.Column<string>("char(3)")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PeopleByDocuments", x => x.Id);
|
||||
table.ForeignKey("FK_PeopleByDocuments_Documents_DocumentId",
|
||||
x => x.DocumentId, "Documents", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_PeopleByDocuments_DocumentPeople_PersonId",
|
||||
x => x.PersonId, "DocumentPeople", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_PeopleByDocuments_DocumentRoles_RoleId",
|
||||
x => x.RoleId, "DocumentRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("PeopleByDocuments", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
PersonId = table.Column<int>(), DocumentId = table.Column<long>(),
|
||||
RoleId = table.Column<string>("char(3)")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PeopleByDocuments", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_PeopleByDocuments_Documents_DocumentId", x => x.DocumentId, "Documents", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_PeopleByDocuments_DocumentPeople_PersonId", x => x.PersonId, "DocumentPeople",
|
||||
"Id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_PeopleByDocuments_DocumentRoles_RoleId", x => x.RoleId, "DocumentRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_PeopleByDocuments_DocumentId", "PeopleByDocuments", "DocumentId");
|
||||
|
||||
@@ -37,9 +34,7 @@ namespace Marechai.Database.Migrations
|
||||
migrationBuilder.CreateIndex("IX_PeopleByDocuments_RoleId", "PeopleByDocuments", "RoleId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("PeopleByDocuments");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,19 +9,15 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
migrationBuilder.AddColumn<int>("DocumentCompanyId", "companies", nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable("DocumentCompanies",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(),
|
||||
CompanyId = table.Column<int>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DocumentCompanies", x => x.Id);
|
||||
});
|
||||
migrationBuilder.CreateTable("DocumentCompanies", table => new
|
||||
{
|
||||
Id = table.Column<int>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(), CompanyId = table.Column<int>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DocumentCompanies", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_companies_DocumentCompanyId", "companies", "DocumentCompanyId",
|
||||
unique: true);
|
||||
|
||||
@@ -7,28 +7,25 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("CompaniesByDocuments",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CompanyId = table.Column<int>(),
|
||||
DocumentId = table.Column<long>(),
|
||||
RoleId = table.Column<string>("char(3)")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CompaniesByDocuments", x => x.Id);
|
||||
table.ForeignKey("FK_CompaniesByDocuments_DocumentCompanies_CompanyId",
|
||||
x => x.CompanyId, "DocumentCompanies", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_CompaniesByDocuments_Documents_DocumentId",
|
||||
x => x.DocumentId, "Documents", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_CompaniesByDocuments_DocumentRoles_RoleId",
|
||||
x => x.RoleId, "DocumentRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("CompaniesByDocuments", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CompanyId = table.Column<int>(), DocumentId = table.Column<long>(),
|
||||
RoleId = table.Column<string>("char(3)")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CompaniesByDocuments", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_CompaniesByDocuments_DocumentCompanies_CompanyId", x => x.CompanyId,
|
||||
"DocumentCompanies", "Id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_CompaniesByDocuments_Documents_DocumentId", x => x.DocumentId, "Documents", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_CompaniesByDocuments_DocumentRoles_RoleId", x => x.RoleId, "DocumentRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_CompaniesByDocuments_CompanyId", "CompaniesByDocuments", "CompanyId");
|
||||
|
||||
@@ -37,9 +34,7 @@ namespace Marechai.Database.Migrations
|
||||
migrationBuilder.CreateIndex("IX_CompaniesByDocuments_RoleId", "CompaniesByDocuments", "RoleId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("CompaniesByDocuments");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,33 +7,28 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("DocumentsByMachines",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DocumentId = table.Column<long>(),
|
||||
MachineId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DocumentsByMachines", x => x.Id);
|
||||
table.ForeignKey("FK_DocumentsByMachines_Documents_DocumentId",
|
||||
x => x.DocumentId, "Documents", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_DocumentsByMachines_machines_MachineId",
|
||||
x => x.MachineId, "machines", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("DocumentsByMachines", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DocumentId = table.Column<long>(), MachineId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DocumentsByMachines", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_DocumentsByMachines_Documents_DocumentId", x => x.DocumentId, "Documents", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_DocumentsByMachines_machines_MachineId", x => x.MachineId, "machines", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_DocumentsByMachines_DocumentId", "DocumentsByMachines", "DocumentId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_DocumentsByMachines_MachineId", "DocumentsByMachines", "MachineId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("DocumentsByMachines");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,25 +7,21 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("DocumentsByMachineFamily",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DocumentId = table.Column<long>(),
|
||||
MachineFamilyId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DocumentsByMachineFamily", x => x.Id);
|
||||
table.ForeignKey("FK_DocumentsByMachineFamily_Documents_DocumentId",
|
||||
x => x.DocumentId, "Documents", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table
|
||||
.ForeignKey("FK_DocumentsByMachineFamily_machine_families_MachineFamilyId",
|
||||
x => x.MachineFamilyId, "machine_families", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("DocumentsByMachineFamily", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DocumentId = table.Column<long>(), MachineFamilyId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DocumentsByMachineFamily", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_DocumentsByMachineFamily_Documents_DocumentId", x => x.DocumentId, "Documents",
|
||||
"Id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_DocumentsByMachineFamily_machine_families_MachineFamilyId", x => x.MachineFamilyId,
|
||||
"machine_families", "id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_DocumentsByMachineFamily_DocumentId", "DocumentsByMachineFamily",
|
||||
"DocumentId");
|
||||
@@ -34,9 +30,7 @@ namespace Marechai.Database.Migrations
|
||||
"MachineFamilyId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("DocumentsByMachineFamily");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,34 +8,31 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("Books",
|
||||
table => new
|
||||
{
|
||||
Id =
|
||||
table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Title = table.Column<string>(),
|
||||
NativeTitle = table.Column<string>(nullable: true),
|
||||
Published = table.Column<DateTime>(nullable: true),
|
||||
CountryId = table.Column<short>(nullable: true),
|
||||
Synopsis = table.Column<string>(maxLength: 262144, nullable: true),
|
||||
Isbn = table.Column<string>(maxLength: 13, nullable: true),
|
||||
Pages = table.Column<short>(nullable: true),
|
||||
Edition = table.Column<int>(nullable: true),
|
||||
PreviousId = table.Column<long>(nullable: true),
|
||||
SourceId = table.Column<long>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Books", x => x.Id);
|
||||
table.ForeignKey("FK_Books_iso3166_1_numeric_CountryId", x => x.CountryId,
|
||||
"iso3166_1_numeric", "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey("FK_Books_Books_PreviousId", x => x.PreviousId, "Books",
|
||||
"Id", onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey("FK_Books_Books_SourceId", x => x.SourceId, "Books", "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
migrationBuilder.CreateTable("Books", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Title = table.Column<string>(), NativeTitle = table.Column<string>(nullable: true),
|
||||
Published = table.Column<DateTime>(nullable: true), CountryId = table.Column<short>(nullable: true),
|
||||
Synopsis = table.Column<string>(maxLength: 262144, nullable: true),
|
||||
Isbn = table.Column<string>(maxLength: 13, nullable: true),
|
||||
Pages = table.Column<short>(nullable: true),
|
||||
Edition = table.Column<int>(nullable: true),
|
||||
PreviousId = table.Column<long>(nullable: true),
|
||||
SourceId = table.Column<long>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Books", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_Books_iso3166_1_numeric_CountryId", x => x.CountryId, "iso3166_1_numeric", "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
table.ForeignKey("FK_Books_Books_PreviousId", x => x.PreviousId, "Books", "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
table.ForeignKey("FK_Books_Books_SourceId", x => x.SourceId, "Books", "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Books_CountryId", "Books", "CountryId");
|
||||
|
||||
@@ -53,15 +50,12 @@ namespace Marechai.Database.Migrations
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Books_SourceId", "Books", "SourceId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Books_Synopsis", "Books", "Synopsis")
|
||||
.Annotation("MySql:FullTextIndex", true);
|
||||
migrationBuilder.CreateIndex("IX_Books_Synopsis", "Books", "Synopsis").
|
||||
Annotation("MySql:FullTextIndex", true);
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Books_Title", "Books", "Title");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("Books");
|
||||
}
|
||||
protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("Books");
|
||||
}
|
||||
}
|
||||
@@ -7,27 +7,24 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("CompaniesByBooks",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CompanyId = table.Column<int>(),
|
||||
BookId = table.Column<long>(),
|
||||
RoleId = table.Column<string>("char(3)")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CompaniesByBooks", x => x.Id);
|
||||
table.ForeignKey("FK_CompaniesByBooks_Books_BookId", x => x.BookId,
|
||||
"Books", "Id", onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_CompaniesByBooks_DocumentCompanies_CompanyId",
|
||||
x => x.CompanyId, "DocumentCompanies", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_CompaniesByBooks_DocumentRoles_RoleId", x => x.RoleId,
|
||||
"DocumentRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("CompaniesByBooks", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CompanyId = table.Column<int>(), BookId = table.Column<long>(), RoleId = table.Column<string>("char(3)")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CompaniesByBooks", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_CompaniesByBooks_Books_BookId", x => x.BookId, "Books", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_CompaniesByBooks_DocumentCompanies_CompanyId", x => x.CompanyId,
|
||||
"DocumentCompanies", "Id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_CompaniesByBooks_DocumentRoles_RoleId", x => x.RoleId, "DocumentRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_CompaniesByBooks_BookId", "CompaniesByBooks", "BookId");
|
||||
|
||||
@@ -36,9 +33,7 @@ namespace Marechai.Database.Migrations
|
||||
migrationBuilder.CreateIndex("IX_CompaniesByBooks_RoleId", "CompaniesByBooks", "RoleId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("CompaniesByBooks");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,27 +7,24 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("PeopleByBooks",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
PersonId = table.Column<int>(),
|
||||
BookId = table.Column<long>(),
|
||||
RoleId = table.Column<string>("char(3)")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PeopleByBooks", x => x.Id);
|
||||
table.ForeignKey("FK_PeopleByBooks_Books_BookId", x => x.BookId, "Books",
|
||||
"Id", onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_PeopleByBooks_DocumentPeople_PersonId",
|
||||
x => x.PersonId, "DocumentPeople", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_PeopleByBooks_DocumentRoles_RoleId", x => x.RoleId,
|
||||
"DocumentRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("PeopleByBooks", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
PersonId = table.Column<int>(), BookId = table.Column<long>(), RoleId = table.Column<string>("char(3)")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PeopleByBooks", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_PeopleByBooks_Books_BookId", x => x.BookId, "Books", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_PeopleByBooks_DocumentPeople_PersonId", x => x.PersonId, "DocumentPeople", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_PeopleByBooks_DocumentRoles_RoleId", x => x.RoleId, "DocumentRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_PeopleByBooks_BookId", "PeopleByBooks", "BookId");
|
||||
|
||||
@@ -36,9 +33,6 @@ namespace Marechai.Database.Migrations
|
||||
migrationBuilder.CreateIndex("IX_PeopleByBooks_RoleId", "PeopleByBooks", "RoleId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("PeopleByBooks");
|
||||
}
|
||||
protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("PeopleByBooks");
|
||||
}
|
||||
}
|
||||
@@ -7,31 +7,28 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("BooksByMachines",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
BookId = table.Column<long>(),
|
||||
MachineId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BooksByMachines", x => x.Id);
|
||||
table.ForeignKey("FK_BooksByMachines_Books_BookId", x => x.BookId, "Books",
|
||||
"Id", onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_BooksByMachines_machines_MachineId", x => x.MachineId,
|
||||
"machines", "id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("BooksByMachines", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
BookId = table.Column<long>(), MachineId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BooksByMachines", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_BooksByMachines_Books_BookId", x => x.BookId, "Books", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_BooksByMachines_machines_MachineId", x => x.MachineId, "machines", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_BooksByMachines_BookId", "BooksByMachines", "BookId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_BooksByMachines_MachineId", "BooksByMachines", "MachineId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("BooksByMachines");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,24 +7,21 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("BooksByMachineFamilies",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
BookId = table.Column<long>(),
|
||||
MachineFamilyId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BooksByMachineFamilies", x => x.Id);
|
||||
table.ForeignKey("FK_BooksByMachineFamilies_Books_BookId", x => x.BookId,
|
||||
"Books", "Id", onDelete: ReferentialAction.Cascade);
|
||||
table
|
||||
.ForeignKey("FK_BooksByMachineFamilies_machine_families_MachineFamilyId",
|
||||
x => x.MachineFamilyId, "machine_families", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("BooksByMachineFamilies", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
BookId = table.Column<long>(), MachineFamilyId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BooksByMachineFamilies", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_BooksByMachineFamilies_Books_BookId", x => x.BookId, "Books", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_BooksByMachineFamilies_machine_families_MachineFamilyId", x => x.MachineFamilyId,
|
||||
"machine_families", "id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_BooksByMachineFamilies_BookId", "BooksByMachineFamilies", "BookId");
|
||||
|
||||
@@ -32,9 +29,7 @@ namespace Marechai.Database.Migrations
|
||||
"MachineFamilyId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("BooksByMachineFamilies");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,26 +8,24 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("Magazines",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Title = table.Column<string>(),
|
||||
NativeTitle = table.Column<string>(nullable: true),
|
||||
Published = table.Column<DateTime>(nullable: true),
|
||||
CountryId = table.Column<short>(nullable: true),
|
||||
Synopsis = table.Column<string>(maxLength: 262144, nullable: true),
|
||||
Issn = table.Column<string>(maxLength: 8, nullable: true),
|
||||
FirstPublication = table.Column<DateTime>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Magazines", x => x.Id);
|
||||
table.ForeignKey("FK_Magazines_iso3166_1_numeric_CountryId",
|
||||
x => x.CountryId, "iso3166_1_numeric", "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
migrationBuilder.CreateTable("Magazines", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Title = table.Column<string>(),
|
||||
NativeTitle = table.Column<string>(nullable: true),
|
||||
Published = table.Column<DateTime>(nullable: true),
|
||||
CountryId = table.Column<short>(nullable: true),
|
||||
Synopsis = table.Column<string>(maxLength: 262144, nullable: true),
|
||||
Issn = table.Column<string>(maxLength: 8, nullable: true),
|
||||
FirstPublication = table.Column<DateTime>(nullable: true)
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Magazines", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_Magazines_iso3166_1_numeric_CountryId", x => x.CountryId, "iso3166_1_numeric",
|
||||
"id", onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Magazines_CountryId", "Magazines", "CountryId");
|
||||
|
||||
@@ -39,15 +37,12 @@ namespace Marechai.Database.Migrations
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Magazines_Published", "Magazines", "Published");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Magazines_Synopsis", "Magazines", "Synopsis")
|
||||
.Annotation("MySql:FullTextIndex", true);
|
||||
migrationBuilder.CreateIndex("IX_Magazines_Synopsis", "Magazines", "Synopsis").
|
||||
Annotation("MySql:FullTextIndex", true);
|
||||
|
||||
migrationBuilder.CreateIndex("IX_Magazines_Title", "Magazines", "Title");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("Magazines");
|
||||
}
|
||||
protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("Magazines");
|
||||
}
|
||||
}
|
||||
@@ -8,25 +8,21 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("MagazineIssues",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
MagazineId = table.Column<long>(),
|
||||
Caption = table.Column<string>(),
|
||||
NativeCaption = table.Column<string>(nullable: true),
|
||||
Published = table.Column<DateTime>(nullable: true),
|
||||
ProductCode = table.Column<string>(maxLength: 18, nullable: true),
|
||||
Pages = table.Column<short>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MagazineIssues", x => x.Id);
|
||||
table.ForeignKey("FK_MagazineIssues_Magazines_MagazineId",
|
||||
x => x.MagazineId, "Magazines", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("MagazineIssues", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
MagazineId = table.Column<long>(), Caption = table.Column<string>(),
|
||||
NativeCaption = table.Column<string>(nullable: true),
|
||||
Published = table.Column<DateTime>(nullable: true),
|
||||
ProductCode = table.Column<string>(maxLength: 18, nullable: true), Pages = table.Column<short>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MagazineIssues", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_MagazineIssues_Magazines_MagazineId", x => x.MagazineId, "Magazines", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MagazineIssues_Caption", "MagazineIssues", "Caption");
|
||||
|
||||
@@ -41,9 +37,6 @@ namespace Marechai.Database.Migrations
|
||||
migrationBuilder.CreateIndex("IX_MagazineIssues_Published", "MagazineIssues", "Published");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable("MagazineIssues");
|
||||
}
|
||||
protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("MagazineIssues");
|
||||
}
|
||||
}
|
||||
@@ -7,28 +7,25 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("CompaniesByMagazines",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CompanyId = table.Column<int>(),
|
||||
MagazineId = table.Column<long>(),
|
||||
RoleId = table.Column<string>("char(3)")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CompaniesByMagazines", x => x.Id);
|
||||
table.ForeignKey("FK_CompaniesByMagazines_DocumentCompanies_CompanyId",
|
||||
x => x.CompanyId, "DocumentCompanies", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_CompaniesByMagazines_Magazines_MagazineId",
|
||||
x => x.MagazineId, "Magazines", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_CompaniesByMagazines_DocumentRoles_RoleId",
|
||||
x => x.RoleId, "DocumentRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("CompaniesByMagazines", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CompanyId = table.Column<int>(), MagazineId = table.Column<long>(),
|
||||
RoleId = table.Column<string>("char(3)")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CompaniesByMagazines", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_CompaniesByMagazines_DocumentCompanies_CompanyId", x => x.CompanyId,
|
||||
"DocumentCompanies", "Id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_CompaniesByMagazines_Magazines_MagazineId", x => x.MagazineId, "Magazines", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_CompaniesByMagazines_DocumentRoles_RoleId", x => x.RoleId, "DocumentRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_CompaniesByMagazines_CompanyId", "CompaniesByMagazines", "CompanyId");
|
||||
|
||||
@@ -37,9 +34,7 @@ namespace Marechai.Database.Migrations
|
||||
migrationBuilder.CreateIndex("IX_CompaniesByMagazines_RoleId", "CompaniesByMagazines", "RoleId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("CompaniesByMagazines");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,28 +7,25 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("PeopleByMagazines",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
PersonId = table.Column<int>(),
|
||||
MagazineId = table.Column<long>(),
|
||||
RoleId = table.Column<string>("char(3)")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PeopleByMagazines", x => x.Id);
|
||||
table.ForeignKey("FK_PeopleByMagazines_MagazineIssues_MagazineId",
|
||||
x => x.MagazineId, "MagazineIssues", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_PeopleByMagazines_DocumentPeople_PersonId",
|
||||
x => x.PersonId, "DocumentPeople", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_PeopleByMagazines_DocumentRoles_RoleId",
|
||||
x => x.RoleId, "DocumentRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("PeopleByMagazines", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
PersonId = table.Column<int>(), MagazineId = table.Column<long>(),
|
||||
RoleId = table.Column<string>("char(3)")
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PeopleByMagazines", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_PeopleByMagazines_MagazineIssues_MagazineId", x => x.MagazineId, "MagazineIssues",
|
||||
"Id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_PeopleByMagazines_DocumentPeople_PersonId", x => x.PersonId, "DocumentPeople",
|
||||
"Id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_PeopleByMagazines_DocumentRoles_RoleId", x => x.RoleId, "DocumentRoles", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_PeopleByMagazines_MagazineId", "PeopleByMagazines", "MagazineId");
|
||||
|
||||
@@ -37,9 +34,7 @@ namespace Marechai.Database.Migrations
|
||||
migrationBuilder.CreateIndex("IX_PeopleByMagazines_RoleId", "PeopleByMagazines", "RoleId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("PeopleByMagazines");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,33 +7,28 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("MagazinesByMachines",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
MagazineId = table.Column<long>(),
|
||||
MachineId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MagazinesByMachines", x => x.Id);
|
||||
table.ForeignKey("FK_MagazinesByMachines_machines_MachineId",
|
||||
x => x.MachineId, "machines", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey("FK_MagazinesByMachines_MagazineIssues_MagazineId",
|
||||
x => x.MagazineId, "MagazineIssues", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("MagazinesByMachines", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
MagazineId = table.Column<long>(), MachineId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MagazinesByMachines", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_MagazinesByMachines_machines_MachineId", x => x.MachineId, "machines", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_MagazinesByMachines_MagazineIssues_MagazineId", x => x.MagazineId,
|
||||
"MagazineIssues", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MagazinesByMachines_MachineId", "MagazinesByMachines", "MachineId");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MagazinesByMachines_MagazineId", "MagazinesByMachines", "MagazineId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("MagazinesByMachines");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,26 +7,21 @@ namespace Marechai.Database.Migrations
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable("MagazinesByMachinesFamilies",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<long>()
|
||||
.Annotation("MySql:ValueGenerationStrategy",
|
||||
MySqlValueGenerationStrategy.IdentityColumn),
|
||||
MagazineId = table.Column<long>(),
|
||||
MachineFamilyId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MagazinesByMachinesFamilies", x => x.Id);
|
||||
table
|
||||
.ForeignKey("FK_MagazinesByMachinesFamilies_machine_families_MachineFamilyId",
|
||||
x => x.MachineFamilyId, "machine_families", "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table
|
||||
.ForeignKey("FK_MagazinesByMachinesFamilies_MagazineIssues_MagazineId",
|
||||
x => x.MagazineId, "MagazineIssues", "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable("MagazinesByMachinesFamilies", table => new
|
||||
{
|
||||
Id = table.Column<long>().
|
||||
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
MagazineId = table.Column<long>(), MachineFamilyId = table.Column<int>()
|
||||
}, constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MagazinesByMachinesFamilies", x => x.Id);
|
||||
|
||||
table.ForeignKey("FK_MagazinesByMachinesFamilies_machine_families_MachineFamilyId",
|
||||
x => x.MachineFamilyId, "machine_families", "id", onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey("FK_MagazinesByMachinesFamilies_MagazineIssues_MagazineId", x => x.MagazineId,
|
||||
"MagazineIssues", "Id", onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex("IX_MagazinesByMachinesFamilies_MachineFamilyId",
|
||||
"MagazinesByMachinesFamilies", "MachineFamilyId");
|
||||
@@ -35,9 +30,7 @@ namespace Marechai.Database.Migrations
|
||||
"MagazineId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropTable("MagazinesByMachinesFamilies");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,22 +35,15 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public class BrowserTest : BaseModel<int>
|
||||
{
|
||||
[DisplayName("User agent")]
|
||||
[Required]
|
||||
[StringLength(128)]
|
||||
[DisplayName("User agent"), Required, StringLength(128)]
|
||||
public string UserAgent { get; set; }
|
||||
[Required]
|
||||
[StringLength(64)]
|
||||
[Required, StringLength(64)]
|
||||
public string Browser { get; set; }
|
||||
[Required]
|
||||
[StringLength(16)]
|
||||
[Required, StringLength(16)]
|
||||
public string Version { get; set; }
|
||||
[DisplayName("Operating system")]
|
||||
[Required]
|
||||
[StringLength(32)]
|
||||
[DisplayName("Operating system"), Required, StringLength(32)]
|
||||
public string Os { get; set; }
|
||||
[Required]
|
||||
[StringLength(8)]
|
||||
[Required, StringLength(8)]
|
||||
public string Platform { get; set; }
|
||||
[DisplayName("GIF87")]
|
||||
public bool Gif87 { get; set; }
|
||||
|
||||
@@ -7,12 +7,11 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public int CompanyId { get; set; }
|
||||
public long BookId { get; set; }
|
||||
[Column(TypeName = "char(3)")]
|
||||
[Required]
|
||||
[Column(TypeName = "char(3)"), Required]
|
||||
public string RoleId { get; set; }
|
||||
|
||||
public virtual DocumentCompany Company { get; set; }
|
||||
public virtual Book Book { get; set; }
|
||||
public virtual DocumentRole Role { get; set; }
|
||||
public virtual DocumentRole Role { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,7 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public int CompanyId { get; set; }
|
||||
public long DocumentId { get; set; }
|
||||
[Column(TypeName = "char(3)")]
|
||||
[Required]
|
||||
[Column(TypeName = "char(3)"), Required]
|
||||
public string RoleId { get; set; }
|
||||
|
||||
public virtual DocumentCompany Company { get; set; }
|
||||
|
||||
@@ -7,8 +7,7 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public int CompanyId { get; set; }
|
||||
public long MagazineId { get; set; }
|
||||
[Column(TypeName = "char(3)")]
|
||||
[Required]
|
||||
[Column(TypeName = "char(3)"), Required]
|
||||
public string RoleId { get; set; }
|
||||
|
||||
public virtual DocumentCompany Company { get; set; }
|
||||
|
||||
@@ -52,18 +52,15 @@ namespace Marechai.Database.Models
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true), DataType(DataType.Date)]
|
||||
public DateTime? Founded { get; set; }
|
||||
[Url]
|
||||
[StringLength(255)]
|
||||
[Url, StringLength(255)]
|
||||
public string Website { get; set; }
|
||||
[StringLength(45)]
|
||||
public string Twitter { get; set; }
|
||||
[StringLength(45)]
|
||||
public string Facebook { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:d}")]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:d}"), DataType(DataType.Date)]
|
||||
public DateTime? Sold { get; set; }
|
||||
public int? SoldToId { get; set; }
|
||||
[StringLength(80)]
|
||||
@@ -72,8 +69,7 @@ namespace Marechai.Database.Models
|
||||
public string City { get; set; }
|
||||
[StringLength(80)]
|
||||
public string Province { get; set; }
|
||||
[StringLength(25)]
|
||||
[DisplayName("Postal code")]
|
||||
[StringLength(25), DisplayName("Postal code")]
|
||||
public string PostalCode { get; set; }
|
||||
public short? CountryId { get; set; }
|
||||
[Required]
|
||||
@@ -96,18 +92,16 @@ namespace Marechai.Database.Models
|
||||
Logos?.OrderByDescending(l => l.Year).FirstOrDefault();
|
||||
public virtual DocumentCompany DocumentCompany { get; set; }
|
||||
|
||||
[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();
|
||||
[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();
|
||||
|
||||
[NotMapped]
|
||||
public CompanyDescription Description => Descriptions?.FirstOrDefault();
|
||||
|
||||
@@ -36,11 +36,9 @@ namespace Marechai.Database.Models
|
||||
public class CompanyDescription : BaseModel<int>
|
||||
{
|
||||
public int CompanyId { get; set; }
|
||||
[MaxLength(262144, ErrorMessage = "Description is too long")]
|
||||
[Required]
|
||||
[MaxLength(262144, ErrorMessage = "Description is too long"), Required]
|
||||
public string Text { get; set; }
|
||||
[MaxLength(262144, ErrorMessage = "Description is too long")]
|
||||
[DisplayName("HTML")]
|
||||
[MaxLength(262144, ErrorMessage = "Description is too long"), DisplayName("HTML")]
|
||||
public string Html { get; set; }
|
||||
|
||||
public virtual Company Company { get; set; }
|
||||
|
||||
@@ -45,9 +45,7 @@ namespace Marechai.Database.Models
|
||||
|
||||
public virtual Company Company { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
[Required(ErrorMessage = "SVG logo required")]
|
||||
[DisplayName("Upload SVG logo:")]
|
||||
[NotMapped, Required(ErrorMessage = "SVG logo required"), DisplayName("Upload SVG logo:")]
|
||||
public IFormFile SvgLogo { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
|
||||
@@ -8,8 +8,7 @@ namespace Marechai.Database.Models
|
||||
[Required]
|
||||
public string Title { get; set; }
|
||||
public string NativeTitle { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:d}")]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:d}"), DataType(DataType.Date)]
|
||||
public DateTime? Published { get; set; }
|
||||
public short? CountryId { get; set; }
|
||||
[MaxLength(262144, ErrorMessage = "Synopsis is too long")]
|
||||
|
||||
@@ -16,8 +16,7 @@ namespace Marechai.Database.Models
|
||||
[DisplayName("Name to be displayed")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
[DisplayName("Name")]
|
||||
[NotMapped, DisplayName("Name")]
|
||||
public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}";
|
||||
|
||||
[DisplayName("Linked person")]
|
||||
|
||||
@@ -5,9 +5,7 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public class DocumentRole
|
||||
{
|
||||
[Column(TypeName = "char(3)")]
|
||||
[Key]
|
||||
[Required]
|
||||
[Column(TypeName = "char(3)"), Key, Required]
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
@@ -45,15 +45,12 @@ namespace Marechai.Database.Models
|
||||
ResolutionsByGpu = new HashSet<ResolutionsByGpu>();
|
||||
}
|
||||
|
||||
[Required]
|
||||
[StringLength(128)]
|
||||
[Required, StringLength(128)]
|
||||
public string Name { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
[DisplayName("Model code")]
|
||||
[StringLength(45)]
|
||||
[DisplayName("Model code"), StringLength(45)]
|
||||
public string ModelCode { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:d}")]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:d}"), DataType(DataType.Date)]
|
||||
public DateTime? Introduced { get; set; }
|
||||
[StringLength(45)]
|
||||
public string Package { get; set; }
|
||||
|
||||
@@ -36,14 +36,9 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public class InstructionSet : BaseModel<int>
|
||||
{
|
||||
public InstructionSet()
|
||||
{
|
||||
Processors = new HashSet<Processor>();
|
||||
}
|
||||
public InstructionSet() => Processors = new HashSet<Processor>();
|
||||
|
||||
[Required]
|
||||
[StringLength(45)]
|
||||
[Remote("VerifyUnique", "InstructionSets", "Admin")]
|
||||
[Required, StringLength(45), Remote("VerifyUnique", "InstructionSets", "Admin")]
|
||||
public string Name { get; set; }
|
||||
|
||||
public virtual ICollection<Processor> Processors { get; set; }
|
||||
|
||||
@@ -37,15 +37,10 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public class InstructionSetExtension : BaseModel<int>
|
||||
{
|
||||
public InstructionSetExtension()
|
||||
{
|
||||
public InstructionSetExtension() =>
|
||||
InstructionSetExtensionsByProcessor = new HashSet<InstructionSetExtensionsByProcessor>();
|
||||
}
|
||||
|
||||
[DisplayName("Name")]
|
||||
[Required]
|
||||
[StringLength(45)]
|
||||
[Remote("VerifyUnique", "InstructionSetExtensions", "Admin")]
|
||||
[DisplayName("Name"), Required, StringLength(45), Remote("VerifyUnique", "InstructionSetExtensions", "Admin")]
|
||||
public string Extension { get; set; }
|
||||
|
||||
public virtual ICollection<InstructionSetExtensionsByProcessor> InstructionSetExtensionsByProcessor
|
||||
|
||||
@@ -35,15 +35,11 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public class Iso31661Numeric
|
||||
{
|
||||
public Iso31661Numeric()
|
||||
{
|
||||
Companies = new HashSet<Company>();
|
||||
}
|
||||
public Iso31661Numeric() => Companies = new HashSet<Company>();
|
||||
|
||||
[Required]
|
||||
public short Id { get; set; }
|
||||
[Required]
|
||||
[StringLength(64)]
|
||||
[Required, StringLength(64)]
|
||||
public string Name { get; set; }
|
||||
|
||||
public virtual ICollection<Company> Companies { get; set; }
|
||||
|
||||
@@ -3,14 +3,10 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Marechai.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// ISO-639 codes
|
||||
/// </summary>
|
||||
/// <summary>ISO-639 codes</summary>
|
||||
public class Iso639
|
||||
{
|
||||
[Column(TypeName = "char(3)")]
|
||||
[Key]
|
||||
[Required]
|
||||
[Column(TypeName = "char(3)"), Key, Required]
|
||||
public string Id { get; set; }
|
||||
[Column(TypeName = "char(3)")]
|
||||
public string Part2B { get; set; }
|
||||
@@ -18,14 +14,11 @@ namespace Marechai.Database.Models
|
||||
public string Part2T { get; set; }
|
||||
[Column(TypeName = "char(2)")]
|
||||
public string Part1 { get; set; }
|
||||
[Column(TypeName = "char(1)")]
|
||||
[Required]
|
||||
[Column(TypeName = "char(1)"), Required]
|
||||
public string Scope { get; set; }
|
||||
[Column(TypeName = "char(1)")]
|
||||
[Required]
|
||||
[Column(TypeName = "char(1)"), Required]
|
||||
public string Type { get; set; }
|
||||
[Column(TypeName = "varchar(150)")]
|
||||
[Required]
|
||||
[Column(TypeName = "varchar(150)"), Required]
|
||||
public string ReferenceName { get; set; }
|
||||
[Column(TypeName = "varchar(150)")]
|
||||
public string Comment { get; set; }
|
||||
|
||||
@@ -11,20 +11,14 @@ namespace Marechai.Database.Models
|
||||
public string Name { get; set; }
|
||||
[DisplayName("SPDX identifier")]
|
||||
public string SPDX { get; set; }
|
||||
[DisplayName("FSF approved")]
|
||||
[Required]
|
||||
[DisplayName("FSF approved"), Required]
|
||||
public bool FsfApproved { get; set; }
|
||||
[DisplayName("OSI approved")]
|
||||
[Required]
|
||||
[DisplayName("OSI approved"), Required]
|
||||
public bool OsiApproved { get; set; }
|
||||
[DisplayName("License text link")]
|
||||
[StringLength(512)]
|
||||
[Url]
|
||||
[DisplayName("License text link"), StringLength(512), Url]
|
||||
public string Link { get; set; }
|
||||
[DisplayName("License text")]
|
||||
[Column(TypeName = "longtext")]
|
||||
[StringLength(131072)]
|
||||
[DataType(DataType.MultilineText)]
|
||||
[DisplayName("License text"), Column(TypeName = "longtext"), StringLength(131072),
|
||||
DataType(DataType.MultilineText)]
|
||||
public string Text { get; set; }
|
||||
public virtual ICollection<MachinePhoto> Photos { get; set; }
|
||||
public virtual ICollection<OwnedMachinePhoto> OwnedMachinePhotos { get; set; }
|
||||
|
||||
@@ -49,13 +49,11 @@ namespace Marechai.Database.Models
|
||||
|
||||
[Required]
|
||||
public int CompanyId { get; set; }
|
||||
[Required]
|
||||
[StringLength(255)]
|
||||
[Required, StringLength(255)]
|
||||
public string Name { get; set; }
|
||||
[Required]
|
||||
public MachineType Type { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:d}")]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:d}"), DataType(DataType.Date)]
|
||||
public DateTime? Introduced { get; set; }
|
||||
public int? FamilyId { get; set; }
|
||||
[StringLength(50)]
|
||||
@@ -74,8 +72,7 @@ namespace Marechai.Database.Models
|
||||
public virtual ICollection<BooksByMachine> Books { get; set; }
|
||||
public virtual ICollection<MagazinesByMachine> Magazines { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
[DisplayName("Introduced")]
|
||||
[NotMapped, DisplayName("Introduced")]
|
||||
public string IntroducedView =>
|
||||
Introduced == DateTime.MinValue ? "Prototype" : Introduced?.ToShortDateString() ?? "Unknown";
|
||||
}
|
||||
|
||||
@@ -35,14 +35,10 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public class MachineFamily : BaseModel<int>
|
||||
{
|
||||
public MachineFamily()
|
||||
{
|
||||
Machines = new HashSet<Machine>();
|
||||
}
|
||||
public MachineFamily() => Machines = new HashSet<Machine>();
|
||||
|
||||
public int CompanyId { get; set; }
|
||||
[Required]
|
||||
[StringLength(255)]
|
||||
[Required, StringLength(255)]
|
||||
public string Name { get; set; }
|
||||
|
||||
public virtual Company Company { get; set; }
|
||||
|
||||
@@ -8,8 +8,7 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
[StringLength(8, MinimumLength = 8)]
|
||||
public string Issn { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:d}")]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:d}"), DataType(DataType.Date)]
|
||||
public DateTime? FirstPublication { get; set; }
|
||||
|
||||
public virtual Iso31661Numeric Country { get; set; }
|
||||
|
||||
@@ -11,8 +11,7 @@ namespace Marechai.Database.Models
|
||||
[Required]
|
||||
public string Caption { get; set; }
|
||||
public string NativeCaption { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:d}")]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:d}"), DataType(DataType.Date)]
|
||||
public DateTime? Published { get; set; }
|
||||
[StringLength(18)]
|
||||
public string ProductCode { get; set; }
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Marechai.Database.Models
|
||||
public virtual DbSet<BooksByMachine> BooksByMachines { get; set; }
|
||||
public virtual DbSet<BooksByMachineFamily> BooksByMachineFamilies { get; set; }
|
||||
public virtual DbSet<BrowserTest> BrowserTests { get; set; }
|
||||
public virtual DbSet<MarechaiDb> MarechaiDb { get; set; }
|
||||
public virtual DbSet<MarechaiDb> MarechaiDb { get; set; }
|
||||
public virtual DbSet<CompaniesByBook> CompaniesByBooks { get; set; }
|
||||
public virtual DbSet<CompaniesByDocument> CompaniesByDocuments { get; set; }
|
||||
public virtual DbSet<CompaniesByMagazine> CompaniesByMagazines { get; set; }
|
||||
@@ -99,9 +99,10 @@ namespace Marechai.Database.Models
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if(optionsBuilder.IsConfigured) return;
|
||||
if(optionsBuilder.IsConfigured)
|
||||
return;
|
||||
|
||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
|
||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http: //go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
|
||||
optionsBuilder.UseMySql("server=localhost;port=3306;user=marechai;password=marechaipass;database=marechai");
|
||||
optionsBuilder.UseLazyLoadingProxies();
|
||||
}
|
||||
@@ -128,11 +129,11 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.HasIndex(e => e.Edition);
|
||||
|
||||
entity.HasOne(d => d.Previous).WithOne(d => d.Next).HasForeignKey<Book>(d => d.PreviousId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull);
|
||||
entity.HasOne(d => d.Previous).WithOne(d => d.Next).HasForeignKey<Book>(d => d.PreviousId).
|
||||
OnDelete(DeleteBehavior.ClientSetNull);
|
||||
|
||||
entity.HasOne(d => d.Source).WithMany(d => d.Derivates).HasForeignKey(d => d.SourceId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull);
|
||||
entity.HasOne(d => d.Source).WithMany(d => d.Derivates).HasForeignKey(d => d.SourceId).
|
||||
OnDelete(DeleteBehavior.ClientSetNull);
|
||||
|
||||
entity.HasOne(d => d.Country).WithMany(p => p.Books).HasForeignKey(d => d.CountryId);
|
||||
});
|
||||
@@ -175,51 +176,51 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id").HasColumnType("int(11)");
|
||||
|
||||
entity.Property(e => e.Agif).HasColumnName("agif").HasColumnType("tinyint(1)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.Agif).HasColumnName("agif").HasColumnType("tinyint(1)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Browser).IsRequired().HasColumnName("browser").HasColumnType("varchar(64)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Browser).IsRequired().HasColumnName("browser").HasColumnType("varchar(64)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Colors).HasColumnName("colors").HasColumnType("tinyint(1)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.Colors).HasColumnName("colors").HasColumnType("tinyint(1)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Flash).HasColumnName("flash").HasColumnType("tinyint(1)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.Flash).HasColumnName("flash").HasColumnType("tinyint(1)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Frames).HasColumnName("frames").HasColumnType("tinyint(1)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.Frames).HasColumnName("frames").HasColumnType("tinyint(1)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Gif87).HasColumnName("gif87").HasColumnType("tinyint(1)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.Gif87).HasColumnName("gif87").HasColumnType("tinyint(1)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Gif89).HasColumnName("gif89").HasColumnType("tinyint(1)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.Gif89).HasColumnName("gif89").HasColumnType("tinyint(1)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Jpeg).HasColumnName("jpeg").HasColumnType("tinyint(1)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.Jpeg).HasColumnName("jpeg").HasColumnType("tinyint(1)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Js).HasColumnName("js").HasColumnType("tinyint(1)").HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Os).IsRequired().HasColumnName("os").HasColumnType("varchar(32)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Os).IsRequired().HasColumnName("os").HasColumnType("varchar(32)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Platform).IsRequired().HasColumnName("platform").HasColumnType("varchar(8)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Platform).IsRequired().HasColumnName("platform").HasColumnType("varchar(8)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Png).HasColumnName("png").HasColumnType("tinyint(1)").HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Pngt).HasColumnName("pngt").HasColumnType("tinyint(1)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.Pngt).HasColumnName("pngt").HasColumnType("tinyint(1)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Table).HasColumnName("table").HasColumnType("tinyint(1)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.Table).HasColumnName("table").HasColumnType("tinyint(1)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.UserAgent).IsRequired().HasColumnName("user_agent").HasColumnType("varchar(128)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.UserAgent).IsRequired().HasColumnName("user_agent").
|
||||
HasColumnType("varchar(128)").HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Version).IsRequired().HasColumnName("version").HasColumnType("varchar(16)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Version).IsRequired().HasColumnName("version").HasColumnType("varchar(16)").
|
||||
HasDefaultValueSql("''");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MarechaiDb>(entity =>
|
||||
@@ -228,8 +229,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id").HasColumnType("int(11)");
|
||||
|
||||
entity.Property(e => e.Updated).HasColumnName("updated").HasColumnType("datetime")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
entity.Property(e => e.Updated).HasColumnName("updated").HasColumnType("datetime").
|
||||
HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
entity.Property(e => e.Version).HasColumnName("version").HasColumnType("int(11)");
|
||||
});
|
||||
@@ -315,8 +316,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Founded).HasColumnName("founded").HasColumnType("datetime");
|
||||
|
||||
entity.Property(e => e.Name).IsRequired().HasColumnName("name").HasColumnType("varchar(128)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Name).IsRequired().HasColumnName("name").HasColumnType("varchar(128)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.PostalCode).HasColumnName("postal_code").HasColumnType("varchar(25)");
|
||||
|
||||
@@ -332,21 +333,24 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Website).HasColumnName("website").HasColumnType("varchar(255)");
|
||||
|
||||
entity.HasOne(d => d.Country).WithMany(p => p.Companies).HasForeignKey(d => d.CountryId)
|
||||
.HasConstraintName("fk_companies_country");
|
||||
entity.HasOne(d => d.Country).WithMany(p => p.Companies).HasForeignKey(d => d.CountryId).
|
||||
HasConstraintName("fk_companies_country");
|
||||
|
||||
entity.HasOne(d => d.SoldTo).WithMany(p => p.InverseSoldToNavigation).HasForeignKey(d => d.SoldToId)
|
||||
.HasConstraintName("fk_companies_sold_to");
|
||||
entity.HasOne(d => d.SoldTo).WithMany(p => p.InverseSoldToNavigation).HasForeignKey(d => d.SoldToId).
|
||||
HasConstraintName("fk_companies_sold_to");
|
||||
|
||||
entity.HasOne(d => d.DocumentCompany).WithOne(p => p.Company)
|
||||
.HasForeignKey<DocumentCompany>(d => d.CompanyId).OnDelete(DeleteBehavior.SetNull);
|
||||
entity.HasOne(d => d.DocumentCompany).WithOne(p => p.Company).
|
||||
HasForeignKey<DocumentCompany>(d => d.CompanyId).OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<CompanyDescription>().HasIndex(e => e.Text).ForMySqlIsFullText();
|
||||
|
||||
modelBuilder.Entity<CompanyLogo>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new {e.Id, e.CompanyId, LogoGuid = e.Guid});
|
||||
entity.HasKey(e => new
|
||||
{
|
||||
e.Id, e.CompanyId, LogoGuid = e.Guid
|
||||
});
|
||||
|
||||
entity.ToTable("company_logos");
|
||||
|
||||
@@ -364,8 +368,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Year).HasColumnName("year").HasColumnType("int(4)");
|
||||
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.Logos).HasForeignKey(d => d.CompanyId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("fk_company_logos_company1");
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.Logos).HasForeignKey(d => d.CompanyId).
|
||||
OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("fk_company_logos_company1");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Document>(entity =>
|
||||
@@ -402,8 +406,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.HasIndex(e => e.DisplayName);
|
||||
|
||||
entity.HasOne(d => d.Person).WithOne(p => p.DocumentPerson)
|
||||
.HasForeignKey<Person>(d => d.DocumentPersonId).OnDelete(DeleteBehavior.SetNull);
|
||||
entity.HasOne(d => d.Person).WithOne(p => p.DocumentPerson).
|
||||
HasForeignKey<Person>(d => d.DocumentPersonId).OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DocumentRole>(entity =>
|
||||
@@ -451,17 +455,17 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id").HasColumnType("int(11)");
|
||||
|
||||
entity.Property(e => e.Browser).IsRequired().HasColumnName("browser").HasColumnType("char(128)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Browser).IsRequired().HasColumnName("browser").HasColumnType("char(128)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Date).IsRequired().HasColumnName("date").HasColumnType("char(20)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Date).IsRequired().HasColumnName("date").HasColumnType("char(20)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Ip).IsRequired().HasColumnName("ip").HasColumnType("char(16)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Ip).IsRequired().HasColumnName("ip").HasColumnType("char(16)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Referer).IsRequired().HasColumnName("referer").HasColumnType("char(255)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Referer).IsRequired().HasColumnName("referer").HasColumnType("char(255)").
|
||||
HasDefaultValueSql("''");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Gpu>(entity =>
|
||||
@@ -496,8 +500,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.ModelCode).HasColumnName("model_code").HasColumnType("varchar(45)");
|
||||
|
||||
entity.Property(e => e.Name).IsRequired().HasColumnName("name").HasColumnType("char(128)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Name).IsRequired().HasColumnName("name").HasColumnType("char(128)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Package).HasColumnName("package").HasColumnType("varchar(45)");
|
||||
|
||||
@@ -507,8 +511,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Transistors).HasColumnName("transistors").HasColumnType("bigint(20)");
|
||||
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.Gpus).HasForeignKey(d => d.CompanyId)
|
||||
.HasConstraintName("fk_gpus_company");
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.Gpus).HasForeignKey(d => d.CompanyId).
|
||||
HasConstraintName("fk_gpus_company");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<GpusByMachine>(entity =>
|
||||
@@ -525,11 +529,11 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.MachineId).HasColumnName("machine").HasColumnType("int(11)");
|
||||
|
||||
entity.HasOne(d => d.Gpu).WithMany(p => p.GpusByMachine).HasForeignKey(d => d.GpuId)
|
||||
.HasConstraintName("fk_gpus_by_machine_gpu");
|
||||
entity.HasOne(d => d.Gpu).WithMany(p => p.GpusByMachine).HasForeignKey(d => d.GpuId).
|
||||
HasConstraintName("fk_gpus_by_machine_gpu");
|
||||
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Gpus).HasForeignKey(d => d.MachineId)
|
||||
.HasConstraintName("fk_gpus_by_machine_machine");
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Gpus).HasForeignKey(d => d.MachineId).
|
||||
HasConstraintName("fk_gpus_by_machine_machine");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<GpusByOwnedMachine>(entity =>
|
||||
@@ -552,7 +556,10 @@ namespace Marechai.Database.Models
|
||||
|
||||
modelBuilder.Entity<InstructionSetExtensionsByProcessor>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new {e.Id, e.ProcessorId, e.ExtensionId});
|
||||
entity.HasKey(e => new
|
||||
{
|
||||
e.Id, e.ProcessorId, e.ExtensionId
|
||||
});
|
||||
|
||||
entity.ToTable("instruction_set_extensions_by_processor");
|
||||
|
||||
@@ -566,13 +573,13 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.ExtensionId).HasColumnName("extension_id").HasColumnType("int(11)");
|
||||
|
||||
entity.HasOne(d => d.Extension).WithMany(p => p.InstructionSetExtensionsByProcessor)
|
||||
.HasForeignKey(d => d.ExtensionId).OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_extension_extension_id");
|
||||
entity.HasOne(d => d.Extension).WithMany(p => p.InstructionSetExtensionsByProcessor).
|
||||
HasForeignKey(d => d.ExtensionId).OnDelete(DeleteBehavior.ClientSetNull).
|
||||
HasConstraintName("fk_extension_extension_id");
|
||||
|
||||
entity.HasOne(d => d.Processor).WithMany(p => p.InstructionSetExtensions)
|
||||
.HasForeignKey(d => d.ProcessorId).OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_extension_processor_id");
|
||||
entity.HasOne(d => d.Processor).WithMany(p => p.InstructionSetExtensions).
|
||||
HasForeignKey(d => d.ProcessorId).OnDelete(DeleteBehavior.ClientSetNull).
|
||||
HasConstraintName("fk_extension_processor_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<InstructionSet>(entity =>
|
||||
@@ -632,17 +639,17 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id").HasColumnType("int(11)");
|
||||
|
||||
entity.Property(e => e.Browser).IsRequired().HasColumnName("browser").HasColumnType("char(128)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Browser).IsRequired().HasColumnName("browser").HasColumnType("char(128)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Date).IsRequired().HasColumnName("date").HasColumnType("char(20)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Date).IsRequired().HasColumnName("date").HasColumnType("char(20)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Ip).IsRequired().HasColumnName("ip").HasColumnType("char(16)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Ip).IsRequired().HasColumnName("ip").HasColumnType("char(16)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Referer).IsRequired().HasColumnName("referer").HasColumnType("char(255)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Referer).IsRequired().HasColumnName("referer").HasColumnType("char(255)").
|
||||
HasDefaultValueSql("''");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MachineFamily>(entity =>
|
||||
@@ -659,8 +666,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Name).IsRequired().HasColumnName("name").HasColumnType("varchar(255)");
|
||||
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.MachineFamilies).HasForeignKey(d => d.CompanyId)
|
||||
.HasConstraintName("fk_machine_families_company");
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.MachineFamilies).HasForeignKey(d => d.CompanyId).
|
||||
HasConstraintName("fk_machine_families_company");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Machine>(entity =>
|
||||
@@ -681,8 +688,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id").HasColumnType("int(11)");
|
||||
|
||||
entity.Property(e => e.CompanyId).HasColumnName("company").HasColumnType("int(11)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.CompanyId).HasColumnName("company").HasColumnType("int(11)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.FamilyId).HasColumnName("family").HasColumnType("int(11)");
|
||||
|
||||
@@ -694,11 +701,11 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Type).HasColumnName("type").HasColumnType("int(11)").HasDefaultValueSql("'0'");
|
||||
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.Machines).HasForeignKey(d => d.CompanyId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("fk_machines_company");
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.Machines).HasForeignKey(d => d.CompanyId).
|
||||
OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("fk_machines_company");
|
||||
|
||||
entity.HasOne(d => d.Family).WithMany(p => p.Machines).HasForeignKey(d => d.FamilyId)
|
||||
.HasConstraintName("fk_machines_family");
|
||||
entity.HasOne(d => d.Family).WithMany(p => p.Machines).HasForeignKey(d => d.FamilyId).
|
||||
HasConstraintName("fk_machines_family");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<OwnedMachine>(entity =>
|
||||
@@ -954,8 +961,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Usage).HasColumnName("usage").HasColumnType("int(11)").HasDefaultValueSql("'0'");
|
||||
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Memory).HasForeignKey(d => d.MachineId)
|
||||
.HasConstraintName("fk_memory_by_machine_machine");
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Memory).HasForeignKey(d => d.MachineId).
|
||||
HasConstraintName("fk_memory_by_machine_machine");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MemoryByOwnedMachine>(entity =>
|
||||
@@ -983,11 +990,11 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id").HasColumnType("int(11)");
|
||||
|
||||
entity.Property(e => e.Donator).IsRequired().HasColumnName("donator").HasColumnType("char(128)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Donator).IsRequired().HasColumnName("donator").HasColumnType("char(128)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Quantity).HasColumnName("quantity").HasColumnType("decimal(11,2)")
|
||||
.HasDefaultValueSql("'0.00'");
|
||||
entity.Property(e => e.Quantity).HasColumnName("quantity").HasColumnType("decimal(11,2)").
|
||||
HasDefaultValueSql("'0.00'");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<News>(entity =>
|
||||
@@ -1002,8 +1009,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id").HasColumnType("int(11)");
|
||||
|
||||
entity.Property(e => e.AddedId).HasColumnName("added_id").HasColumnType("int(11)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.AddedId).HasColumnName("added_id").HasColumnType("int(11)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Date).IsRequired().HasColumnName("date").HasColumnType("datetime");
|
||||
|
||||
@@ -1086,8 +1093,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.HasOne(d => d.CountryOfBirth).WithMany(p => p.People).HasForeignKey(d => d.CountryOfBirthId);
|
||||
|
||||
entity.HasOne(d => d.DocumentPerson).WithOne(p => p.Person)
|
||||
.HasForeignKey<DocumentPerson>(d => d.PersonId).OnDelete(DeleteBehavior.SetNull);
|
||||
entity.HasOne(d => d.DocumentPerson).WithOne(p => p.Person).
|
||||
HasForeignKey<DocumentPerson>(d => d.PersonId).OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Processor>(entity =>
|
||||
@@ -1174,8 +1181,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.ModelCode).HasColumnName("model_code").HasColumnType("varchar(45)");
|
||||
|
||||
entity.Property(e => e.Name).IsRequired().HasColumnName("name").HasColumnType("char(50)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Name).IsRequired().HasColumnName("name").HasColumnType("char(50)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.Package).HasColumnName("package").HasColumnType("varchar(45)");
|
||||
|
||||
@@ -1193,11 +1200,11 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Transistors).HasColumnName("transistors").HasColumnType("bigint(20)");
|
||||
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.Processors).HasForeignKey(d => d.CompanyId)
|
||||
.HasConstraintName("fk_processors_company");
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.Processors).HasForeignKey(d => d.CompanyId).
|
||||
HasConstraintName("fk_processors_company");
|
||||
|
||||
entity.HasOne(d => d.InstructionSet).WithMany(p => p.Processors).HasForeignKey(d => d.InstructionSetId)
|
||||
.HasConstraintName("fk_processors_instruction_set");
|
||||
entity.HasOne(d => d.InstructionSet).WithMany(p => p.Processors).HasForeignKey(d => d.InstructionSetId).
|
||||
HasConstraintName("fk_processors_instruction_set");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ProcessorsByMachine>(entity =>
|
||||
@@ -1218,11 +1225,11 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Speed).HasColumnName("speed");
|
||||
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Processors).HasForeignKey(d => d.MachineId)
|
||||
.HasConstraintName("fk_processors_by_machine_machine");
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Processors).HasForeignKey(d => d.MachineId).
|
||||
HasConstraintName("fk_processors_by_machine_machine");
|
||||
|
||||
entity.HasOne(d => d.Processor).WithMany(p => p.ProcessorsByMachine).HasForeignKey(d => d.ProcessorId)
|
||||
.HasConstraintName("fk_processors_by_machine_processor");
|
||||
entity.HasOne(d => d.Processor).WithMany(p => p.ProcessorsByMachine).HasForeignKey(d => d.ProcessorId).
|
||||
HasConstraintName("fk_processors_by_machine_processor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ProcessorsByOwnedMachine>(entity =>
|
||||
@@ -1248,23 +1255,30 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.HasIndex(e => e.Width).HasName("idx_resolutions_width");
|
||||
|
||||
entity.HasIndex(e => new {e.Width, e.Height}).HasName("idx_resolutions_resolution");
|
||||
entity.HasIndex(e => new
|
||||
{
|
||||
e.Width, e.Height
|
||||
}).HasName("idx_resolutions_resolution");
|
||||
|
||||
entity.HasIndex(e => new {e.Width, e.Height, e.Colors})
|
||||
.HasName("idx_resolutions_resolution_with_color");
|
||||
entity.HasIndex(e => new
|
||||
{
|
||||
e.Width, e.Height, e.Colors
|
||||
}).HasName("idx_resolutions_resolution_with_color");
|
||||
|
||||
entity.HasIndex(e => new {e.Width, e.Height, e.Colors, e.Palette})
|
||||
.HasName("idx_resolutions_resolution_with_color_and_palette");
|
||||
entity.HasIndex(e => new
|
||||
{
|
||||
e.Width, e.Height, e.Colors, e.Palette
|
||||
}).HasName("idx_resolutions_resolution_with_color_and_palette");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id").HasColumnType("int(11)");
|
||||
|
||||
entity.Property(e => e.Chars).HasColumnName("chars").HasColumnType("tinyint(1)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.Chars).HasColumnName("chars").HasColumnType("tinyint(1)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Colors).HasColumnName("colors").HasColumnType("bigint(20)");
|
||||
|
||||
entity.Property(e => e.Height).HasColumnName("height").HasColumnType("int(11)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.Height).HasColumnName("height").HasColumnType("int(11)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.Palette).HasColumnName("palette").HasColumnType("bigint(20)");
|
||||
|
||||
@@ -1285,11 +1299,11 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.ResolutionId).HasColumnName("resolution").HasColumnType("int(11)");
|
||||
|
||||
entity.HasOne(d => d.Gpu).WithMany(p => p.ResolutionsByGpu).HasForeignKey(d => d.GpuId)
|
||||
.HasConstraintName("fk_resolutions_by_gpu_gpu");
|
||||
entity.HasOne(d => d.Gpu).WithMany(p => p.ResolutionsByGpu).HasForeignKey(d => d.GpuId).
|
||||
HasConstraintName("fk_resolutions_by_gpu_gpu");
|
||||
|
||||
entity.HasOne(d => d.Resolution).WithMany(p => p.ResolutionsByGpu).HasForeignKey(d => d.ResolutionId)
|
||||
.HasConstraintName("fk_resolutions_by_gpu_resolution");
|
||||
entity.HasOne(d => d.Resolution).WithMany(p => p.ResolutionsByGpu).HasForeignKey(d => d.ResolutionId).
|
||||
HasConstraintName("fk_resolutions_by_gpu_resolution");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ResolutionsByScreen>(entity =>
|
||||
@@ -1335,11 +1349,11 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.SoundSynthId).HasColumnName("sound_synth").HasColumnType("int(11)");
|
||||
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Sound).HasForeignKey(d => d.MachineId)
|
||||
.HasConstraintName("fk_sound_by_machine_machine");
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Sound).HasForeignKey(d => d.MachineId).
|
||||
HasConstraintName("fk_sound_by_machine_machine");
|
||||
|
||||
entity.HasOne(d => d.SoundSynth).WithMany(p => p.SoundByMachine).HasForeignKey(d => d.SoundSynthId)
|
||||
.HasConstraintName("fk_sound_by_machine_sound_synth");
|
||||
entity.HasOne(d => d.SoundSynth).WithMany(p => p.SoundByMachine).HasForeignKey(d => d.SoundSynthId).
|
||||
HasConstraintName("fk_sound_by_machine_sound_synth");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<SoundByOwnedMachine>(entity =>
|
||||
@@ -1387,8 +1401,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.ModelCode).HasColumnName("model_code").HasColumnType("varchar(45)");
|
||||
|
||||
entity.Property(e => e.Name).IsRequired().HasColumnName("name").HasColumnType("char(50)")
|
||||
.HasDefaultValueSql("''");
|
||||
entity.Property(e => e.Name).IsRequired().HasColumnName("name").HasColumnType("char(50)").
|
||||
HasDefaultValueSql("''");
|
||||
|
||||
entity.Property(e => e.SquareWave).HasColumnName("square_wave").HasColumnType("int(11)");
|
||||
|
||||
@@ -1398,8 +1412,8 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.WhiteNoise).HasColumnName("white_noise").HasColumnType("int(11)");
|
||||
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.SoundSynths).HasForeignKey(d => d.CompanyId)
|
||||
.HasConstraintName("fk_sound_synths_company");
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.SoundSynths).HasForeignKey(d => d.CompanyId).
|
||||
HasConstraintName("fk_sound_synths_company");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<StorageByMachine>(entity =>
|
||||
@@ -1418,15 +1432,15 @@ namespace Marechai.Database.Models
|
||||
|
||||
entity.Property(e => e.Capacity).HasColumnName("capacity").HasColumnType("bigint(20)");
|
||||
|
||||
entity.Property(e => e.Interface).HasColumnName("interface").HasColumnType("int(11)")
|
||||
.HasDefaultValueSql("'0'");
|
||||
entity.Property(e => e.Interface).HasColumnName("interface").HasColumnType("int(11)").
|
||||
HasDefaultValueSql("'0'");
|
||||
|
||||
entity.Property(e => e.MachineId).HasColumnName("machine").HasColumnType("int(11)");
|
||||
|
||||
entity.Property(e => e.Type).HasColumnName("type").HasColumnType("int(11)").HasDefaultValueSql("'0'");
|
||||
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Storage).HasForeignKey(d => d.MachineId)
|
||||
.HasConstraintName("fk_storage_by_machine_machine");
|
||||
entity.HasOne(d => d.Machine).WithMany(p => p.Storage).HasForeignKey(d => d.MachineId).
|
||||
HasConstraintName("fk_storage_by_machine_machine");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<StorageByOwnedMachine>(entity =>
|
||||
|
||||
@@ -34,8 +34,8 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public class MarechaiDb
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Version { get; set; }
|
||||
public int Id { get; set; }
|
||||
public int Version { get; set; }
|
||||
public DateTimeOffset? Updated { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,7 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public int PersonId { get; set; }
|
||||
public long BookId { get; set; }
|
||||
[Column(TypeName = "char(3)")]
|
||||
[Required]
|
||||
[Column(TypeName = "char(3)"), Required]
|
||||
public string RoleId { get; set; }
|
||||
|
||||
public virtual DocumentPerson Person { get; set; }
|
||||
|
||||
@@ -7,8 +7,7 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public int PersonId { get; set; }
|
||||
public long DocumentId { get; set; }
|
||||
[Column(TypeName = "char(3)")]
|
||||
[Required]
|
||||
[Column(TypeName = "char(3)"), Required]
|
||||
public string RoleId { get; set; }
|
||||
|
||||
public virtual DocumentPerson Person { get; set; }
|
||||
|
||||
@@ -7,8 +7,7 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public int PersonId { get; set; }
|
||||
public long MagazineId { get; set; }
|
||||
[Column(TypeName = "char(3)")]
|
||||
[Required]
|
||||
[Column(TypeName = "char(3)"), Required]
|
||||
public string RoleId { get; set; }
|
||||
|
||||
public virtual DocumentPerson Person { get; set; }
|
||||
|
||||
@@ -15,11 +15,9 @@ namespace Marechai.Database.Models
|
||||
public string Surname { get; set; }
|
||||
[DisplayName("Country of birth")]
|
||||
public virtual Iso31661Numeric CountryOfBirth { get; set; }
|
||||
[DisplayName("Birth date")]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayName("Birth date"), DataType(DataType.Date)]
|
||||
public DateTime BirthDate { get; set; }
|
||||
[DisplayName("Date of death")]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayName("Date of death"), DataType(DataType.Date)]
|
||||
public DateTime? DeathDate { get; set; }
|
||||
[Url]
|
||||
public string Webpage { get; set; }
|
||||
@@ -32,8 +30,7 @@ namespace Marechai.Database.Models
|
||||
[DisplayName("Name to be displayed")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
[DisplayName("Name")]
|
||||
[NotMapped, DisplayName("Name")]
|
||||
public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}";
|
||||
|
||||
public short? CountryOfBirthId { get; set; }
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Describes general purpose processors or application specific coprocessors
|
||||
// that are not strictly for graphic or sound generation.
|
||||
// that are not strictly for graphic or sound generation.
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
@@ -45,15 +45,12 @@ namespace Marechai.Database.Models
|
||||
ProcessorsByMachine = new HashSet<ProcessorsByMachine>();
|
||||
}
|
||||
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
[Required, StringLength(50)]
|
||||
public string Name { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
[DisplayName("Model code")]
|
||||
[StringLength(45)]
|
||||
[DisplayName("Model code"), StringLength(45)]
|
||||
public string ModelCode { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:d}")]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:d}"), DataType(DataType.Date)]
|
||||
public DateTime? Introduced { get; set; }
|
||||
[DisplayName("Instruction set")]
|
||||
public int? InstructionSetId { get; set; }
|
||||
|
||||
@@ -36,16 +36,11 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public class Resolution : BaseModel<int>
|
||||
{
|
||||
public Resolution()
|
||||
{
|
||||
ResolutionsByGpu = new HashSet<ResolutionsByGpu>();
|
||||
}
|
||||
public Resolution() => ResolutionsByGpu = new HashSet<ResolutionsByGpu>();
|
||||
|
||||
[Required]
|
||||
[Range(1, 131072)]
|
||||
[Required, Range(1, 131072)]
|
||||
public int Width { get; set; }
|
||||
[Required]
|
||||
[Range(1, 131072)]
|
||||
[Required, Range(1, 131072)]
|
||||
public int Height { get; set; }
|
||||
[Range(2, 281474976710656)]
|
||||
public long? Colors { get; set; }
|
||||
@@ -66,27 +61,27 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
if(Chars)
|
||||
{
|
||||
if(Colors == null) return $"{Width}x{Height} characters";
|
||||
if(Colors == null)
|
||||
return$"{Width}x{Height} characters";
|
||||
|
||||
if(Palette != null && Colors != Palette)
|
||||
return Grayscale
|
||||
? $"{Width}x{Height} characters at {Colors} grays from a palette of {Palette}"
|
||||
if(Palette != null &&
|
||||
Colors != Palette)
|
||||
return Grayscale ? $"{Width}x{Height} characters at {Colors} grays from a palette of {Palette}"
|
||||
: $"{Width}x{Height} characters at {Colors} colors from a palette of {Palette}";
|
||||
|
||||
return Colors == 2 && Grayscale
|
||||
? $"{Width}x{Height} black and white characters"
|
||||
return Colors == 2 && Grayscale ? $"{Width}x{Height} black and white characters"
|
||||
: $"{Width}x{Height} characters at {Colors} colors";
|
||||
}
|
||||
|
||||
if(Colors == null) return $"{Width}x{Height} pixels";
|
||||
if(Colors == null)
|
||||
return$"{Width}x{Height} pixels";
|
||||
|
||||
if(Palette != null && Colors != Palette)
|
||||
return Grayscale
|
||||
? $"{Width}x{Height} pixels at {Colors} grays from a palette of {Palette}"
|
||||
if(Palette != null &&
|
||||
Colors != Palette)
|
||||
return Grayscale ? $"{Width}x{Height} pixels at {Colors} grays from a palette of {Palette}"
|
||||
: $"{Width}x{Height} pixels at {Colors} colors from a palette of {Palette}";
|
||||
|
||||
return Colors == 2 && Grayscale
|
||||
? $"{Width}x{Height} black and white pixels"
|
||||
return Colors == 2 && Grayscale ? $"{Width}x{Height} black and white pixels"
|
||||
: $"{Width}x{Height} pixels at {Colors} colors";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
// Copyright © 2003-2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
using System.ComponentModel;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Marechai.Database.Models
|
||||
@@ -40,7 +39,7 @@ namespace Marechai.Database.Models
|
||||
[Remote("VerifyUnique", "ResolutionsByScreen", "Admin", AdditionalFields = nameof(ScreenId))]
|
||||
public int ResolutionId { get; set; }
|
||||
|
||||
public virtual Screen Screen { get; set; }
|
||||
public virtual Screen Screen { get; set; }
|
||||
public virtual Resolution Resolution { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,19 +7,15 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public class Screen : BaseModel<int>
|
||||
{
|
||||
[Range(1, 131072)]
|
||||
[DisplayName("Width (mm)")]
|
||||
[Range(1, 131072), DisplayName("Width (mm)")]
|
||||
public double? Width { get; set; }
|
||||
[Range(1, 131072)]
|
||||
[DisplayName("Height (mm)")]
|
||||
[Range(1, 131072), DisplayName("Height (mm)")]
|
||||
public double? Height { get; set; }
|
||||
[Required]
|
||||
[DisplayName("Diagonal (inches)")]
|
||||
[Required, DisplayName("Diagonal (inches)")]
|
||||
public double Diagonal { get; set; }
|
||||
[DisplayName("Native resolution")]
|
||||
public virtual Resolution NativeResolution { get; set; }
|
||||
[Range(2, 281474976710656)]
|
||||
[DisplayName("Effective colors")]
|
||||
[Range(2, 281474976710656), DisplayName("Effective colors")]
|
||||
public long? EffectiveColors { get; set; }
|
||||
[Required]
|
||||
public string Type { get; set; }
|
||||
@@ -32,9 +28,11 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
if(Width != null && Height != null) return $"{Width}x{Height} mm";
|
||||
if(Width != null &&
|
||||
Height != null)
|
||||
return$"{Width}x{Height} mm";
|
||||
|
||||
return "Unknown";
|
||||
return"Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,34 +38,24 @@ namespace Marechai.Database.Models
|
||||
{
|
||||
public class SoundSynth : BaseModel<int>
|
||||
{
|
||||
public SoundSynth()
|
||||
{
|
||||
SoundByMachine = new HashSet<SoundByMachine>();
|
||||
}
|
||||
public SoundSynth() => SoundByMachine = new HashSet<SoundByMachine>();
|
||||
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
[Required, StringLength(50)]
|
||||
public string Name { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
[DisplayName("Model code")]
|
||||
[StringLength(45)]
|
||||
[DisplayName("Model code"), StringLength(45)]
|
||||
public string ModelCode { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:d}")]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:d}"), DataType(DataType.Date)]
|
||||
public DateTime? Introduced { get; set; }
|
||||
[DisplayName("PCM voices")]
|
||||
[Range(1, int.MaxValue)]
|
||||
[DisplayName("PCM voices"), Range(1, int.MaxValue)]
|
||||
public int? Voices { get; set; }
|
||||
[DisplayName("Sample rate (Hz)")]
|
||||
public double? Frequency { get; set; }
|
||||
[DisplayName("Sample resolution")]
|
||||
[Range(1, int.MaxValue)]
|
||||
[DisplayName("Sample resolution"), Range(1, int.MaxValue)]
|
||||
public int? Depth { get; set; }
|
||||
[DisplayName("Square wave channels")]
|
||||
[Range(1, int.MaxValue)]
|
||||
[DisplayName("Square wave channels"), Range(1, int.MaxValue)]
|
||||
public int? SquareWave { get; set; }
|
||||
[DisplayName("White noise channels")]
|
||||
[Range(1, int.MaxValue)]
|
||||
[DisplayName("White noise channels"), Range(1, int.MaxValue)]
|
||||
public int? WhiteNoise { get; set; }
|
||||
public int? Type { get; set; }
|
||||
|
||||
|
||||
@@ -50,17 +50,18 @@ namespace Marechai.Database
|
||||
command.CommandText = "SELECT LAST_INSERT_ID()";
|
||||
IDataReader reader = command.ExecuteReader();
|
||||
|
||||
if(reader == null || !reader.Read()) return 0;
|
||||
if(reader == null ||
|
||||
!reader.Read())
|
||||
return 0;
|
||||
|
||||
long id = reader.GetInt64(0);
|
||||
reader.Close();
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens an existing database
|
||||
/// </summary>
|
||||
/// <summary>Opens an existing database</summary>
|
||||
/// <param name="server">Server</param>
|
||||
/// <param name="user">User</param>
|
||||
/// <param name="database">Database name</param>
|
||||
@@ -81,9 +82,11 @@ namespace Marechai.Database
|
||||
|
||||
bool res = Operations.UpdateDatabase();
|
||||
|
||||
if(res) return true;
|
||||
if(res)
|
||||
return true;
|
||||
|
||||
connection = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
catch(MySqlException ex)
|
||||
@@ -91,31 +94,26 @@ namespace Marechai.Database
|
||||
Console.WriteLine("Error opening database.");
|
||||
Console.WriteLine(ex);
|
||||
connection = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the database
|
||||
/// </summary>
|
||||
/// <summary>Closes the database</summary>
|
||||
public void CloseDb()
|
||||
{
|
||||
connection?.Close();
|
||||
connection = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a data adapter for the opened database
|
||||
/// </summary>
|
||||
/// <summary>Gets a data adapter for the opened database</summary>
|
||||
/// <returns>Data adapter</returns>
|
||||
public IDbDataAdapter GetNewDataAdapter()
|
||||
{
|
||||
return new MySqlDataAdapter();
|
||||
}
|
||||
public IDbDataAdapter GetNewDataAdapter() => new MySqlDataAdapter();
|
||||
|
||||
public bool TableExists(string tableName)
|
||||
{
|
||||
MySqlCommand cmd = connection.CreateCommand();
|
||||
|
||||
cmd.CommandText =
|
||||
$"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{connection.Database}' AND table_name = '{tableName}'";
|
||||
|
||||
@@ -125,12 +123,10 @@ namespace Marechai.Database
|
||||
|
||||
int count = reader.GetInt32(0);
|
||||
reader.Close();
|
||||
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
~Mysql()
|
||||
{
|
||||
CloseDb();
|
||||
}
|
||||
~Mysql() => CloseDb();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V9.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('10');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('10');";
|
||||
|
||||
public static readonly string Companies = V9.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V10.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('11');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('11');";
|
||||
|
||||
public static readonly string Companies = V10.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V11.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('12');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('12');";
|
||||
|
||||
public static readonly string Companies = V11.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V12.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('13');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('13');";
|
||||
|
||||
public static readonly string Companies = V12.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V13.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('14');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('14');";
|
||||
|
||||
public static readonly string Companies = V13.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V14.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('15');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('15');";
|
||||
|
||||
public static readonly string Companies = V14.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V15.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('16');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('16');";
|
||||
|
||||
public static readonly string Companies = V15.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V16.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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 marechai_db (version) VALUES ('17');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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 marechai_db (version) VALUES ('17');";
|
||||
|
||||
public static readonly string Companies = V16.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V17.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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 marechai_db (version) VALUES ('18');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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 marechai_db (version) VALUES ('18');";
|
||||
|
||||
public static readonly string Companies = V17.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V18.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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 marechai_db (version) VALUES ('19');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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 marechai_db (version) VALUES ('19');";
|
||||
|
||||
public static readonly string Companies = V18.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V19.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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 marechai_db (version) VALUES ('20');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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 marechai_db (version) VALUES ('20');";
|
||||
|
||||
public static readonly string Companies = V19.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V20.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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 marechai_db (version) VALUES ('21');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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 marechai_db (version) VALUES ('21');";
|
||||
|
||||
public static readonly string Companies = V20.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V21.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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 marechai_db (version) VALUES ('22');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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 marechai_db (version) VALUES ('22');";
|
||||
|
||||
public static readonly string Companies = V21.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V5.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('6');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('6');";
|
||||
|
||||
public static readonly string Companies = "CREATE TABLE `companies` (\n" +
|
||||
"`id` int(11) NOT NULL AUTO_INCREMENT,\n" +
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V6.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('7');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('7');";
|
||||
|
||||
public static readonly string Companies = "CREATE TABLE `companies` (\n" +
|
||||
"`id` int(11) NOT NULL AUTO_INCREMENT,\n" +
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V7.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('8');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('8');";
|
||||
|
||||
public static readonly string Companies = V7.Companies;
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Marechai.Database.Schemas.Sql
|
||||
|
||||
public static readonly string BrowserTests = V8.BrowserTests;
|
||||
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('9');";
|
||||
public static readonly string MarechaiDb = "CREATE TABLE `marechai_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" + ");\n" +
|
||||
"INSERT INTO marechai_db (version) VALUES ('9');";
|
||||
|
||||
public static readonly string Companies = V8.Companies;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -37,29 +37,28 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Marechai.Areas.Admin.Controllers
|
||||
{
|
||||
[Area("Admin")]
|
||||
[Authorize]
|
||||
[Area("Admin"), Authorize]
|
||||
public class BrowserTestsController : Controller
|
||||
{
|
||||
readonly MarechaiContext _context;
|
||||
|
||||
public BrowserTestsController(MarechaiContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
public BrowserTestsController(MarechaiContext context) => _context = context;
|
||||
|
||||
// GET: Admin/BrowserTests
|
||||
public async Task<IActionResult> Index() =>
|
||||
View(await _context.BrowserTests.OrderBy(b => b.Browser).ThenBy(b => b.Version).ThenBy(b => b.Os)
|
||||
.ThenBy(b => b.Platform).ThenBy(b => b.UserAgent).ToListAsync());
|
||||
View(await _context.BrowserTests.OrderBy(b => b.Browser).ThenBy(b => b.Version).ThenBy(b => b.Os).
|
||||
ThenBy(b => b.Platform).ThenBy(b => b.UserAgent).ToListAsync());
|
||||
|
||||
// GET: Admin/BrowserTests/Details/5
|
||||
public async Task<IActionResult> Details(int? id)
|
||||
{
|
||||
if(id == null) return NotFound();
|
||||
if(id == null)
|
||||
return NotFound();
|
||||
|
||||
BrowserTest browserTest = await _context.BrowserTests.FirstOrDefaultAsync(m => m.Id == id);
|
||||
if(browserTest == null) return NotFound();
|
||||
|
||||
if(browserTest == null)
|
||||
return NotFound();
|
||||
|
||||
return View(browserTest);
|
||||
}
|
||||
@@ -67,10 +66,13 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
// GET: Admin/BrowserTests/Edit/5
|
||||
public async Task<IActionResult> Edit(int? id)
|
||||
{
|
||||
if(id == null) return NotFound();
|
||||
if(id == null)
|
||||
return NotFound();
|
||||
|
||||
BrowserTest browserTest = await _context.BrowserTests.FindAsync(id);
|
||||
if(browserTest == null) return NotFound();
|
||||
|
||||
if(browserTest == null)
|
||||
return NotFound();
|
||||
|
||||
return View(browserTest);
|
||||
}
|
||||
@@ -78,16 +80,17 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
// POST: Admin/BrowserTests/Edit/5
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(
|
||||
int id, [Bind(
|
||||
"Id,UserAgent,Browser,Version,Os,Platform,Gif87,Gif89,Jpeg,Png,Pngt,Agif,Table,Colors,Js,Frames,Flash")]
|
||||
int id,
|
||||
[Bind("Id,UserAgent,Browser,Version,Os,Platform,Gif87,Gif89,Jpeg,Png,Pngt,Agif,Table,Colors,Js,Frames,Flash")]
|
||||
BrowserTest browserTest)
|
||||
{
|
||||
if(id != browserTest.Id) return NotFound();
|
||||
if(id != browserTest.Id)
|
||||
return NotFound();
|
||||
|
||||
if(!ModelState.IsValid) return View(browserTest);
|
||||
if(!ModelState.IsValid)
|
||||
return View(browserTest);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -96,7 +99,8 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
}
|
||||
catch(DbUpdateConcurrencyException)
|
||||
{
|
||||
if(!BrowserTestExists(browserTest.Id)) return NotFound();
|
||||
if(!BrowserTestExists(browserTest.Id))
|
||||
return NotFound();
|
||||
|
||||
throw;
|
||||
}
|
||||
@@ -107,29 +111,28 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
// GET: Admin/BrowserTests/Delete/5
|
||||
public async Task<IActionResult> Delete(int? id)
|
||||
{
|
||||
if(id == null) return NotFound();
|
||||
if(id == null)
|
||||
return NotFound();
|
||||
|
||||
BrowserTest browserTest = await _context.BrowserTests.FirstOrDefaultAsync(m => m.Id == id);
|
||||
if(browserTest == null) return NotFound();
|
||||
|
||||
if(browserTest == null)
|
||||
return NotFound();
|
||||
|
||||
return View(browserTest);
|
||||
}
|
||||
|
||||
// POST: Admin/BrowserTests/Delete/5
|
||||
[HttpPost]
|
||||
[ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(int id)
|
||||
{
|
||||
BrowserTest browserTest = await _context.BrowserTests.FindAsync(id);
|
||||
_context.BrowserTests.Remove(browserTest);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
bool BrowserTestExists(int id)
|
||||
{
|
||||
return _context.BrowserTests.Any(e => e.Id == id);
|
||||
}
|
||||
bool BrowserTestExists(int id) => _context.BrowserTests.Any(e => e.Id == id);
|
||||
}
|
||||
}
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Marechai.Database.Models;
|
||||
using Marechai.Areas.Admin.Models;
|
||||
using Marechai.Database.Models;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
@@ -40,42 +40,37 @@ using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace Marechai.Areas.Admin.Controllers
|
||||
{
|
||||
[Area("Admin")]
|
||||
[Authorize]
|
||||
[Area("Admin"), Authorize]
|
||||
public class CompaniesController : Controller
|
||||
{
|
||||
readonly MarechaiContext _context;
|
||||
|
||||
public CompaniesController(MarechaiContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
public CompaniesController(MarechaiContext context) => _context = context;
|
||||
|
||||
// GET: Admin/Companies
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
IIncludableQueryable<Company, Company> marechaiContext =
|
||||
_context.Companies.Include(c => c.Country).Include(c => c.SoldTo);
|
||||
|
||||
return View(marechaiContext.OrderBy(c => c.Name).Select(c => new CompanyViewModel
|
||||
{
|
||||
Id = c.Id,
|
||||
Name = c.Name,
|
||||
Founded = c.Founded,
|
||||
Status = c.Status,
|
||||
Country = c.Country.Name,
|
||||
Sold = c.Sold,
|
||||
SoldTo = c.SoldTo.Name
|
||||
Id = c.Id, Name = c.Name, Founded = c.Founded, Status = c.Status,
|
||||
Country = c.Country.Name, Sold = c.Sold, SoldTo = c.SoldTo.Name
|
||||
}));
|
||||
}
|
||||
|
||||
// GET: Admin/Companies/Details/5
|
||||
public async Task<IActionResult> Details(int? id)
|
||||
{
|
||||
if(id == null) return NotFound();
|
||||
if(id == null)
|
||||
return NotFound();
|
||||
|
||||
Company company = await _context.Companies.Include(c => c.Country).Include(c => c.SoldTo)
|
||||
.FirstOrDefaultAsync(m => m.Id == id);
|
||||
if(company == null) return NotFound();
|
||||
Company company = await _context.Companies.Include(c => c.Country).Include(c => c.SoldTo).
|
||||
FirstOrDefaultAsync(m => m.Id == id);
|
||||
|
||||
if(company == null)
|
||||
return NotFound();
|
||||
|
||||
return View(company);
|
||||
}
|
||||
@@ -84,60 +79,67 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewData["CountryId"] = new SelectList(_context.Iso31661Numeric.OrderBy(c => c.Name), "Id", "Name");
|
||||
ViewData["SoldToId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name");
|
||||
ViewData["SoldToId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name");
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Admin/Companies/Create
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(
|
||||
[Bind(
|
||||
"Id,Name,Founded,Website,Twitter,Facebook,Sold,SoldToId,Address,City,Province,PostalCode,CountryId,Status")]
|
||||
[Bind("Id,Name,Founded,Website,Twitter,Facebook,Sold,SoldToId,Address,City,Province,PostalCode,CountryId,Status")]
|
||||
Company company)
|
||||
{
|
||||
if(ModelState.IsValid)
|
||||
{
|
||||
_context.Add(company);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
ViewData["CountryId"] =
|
||||
new SelectList(_context.Iso31661Numeric.OrderBy(c => c.Name), "Id", "Name", company.CountryId);
|
||||
|
||||
ViewData["SoldToId"] =
|
||||
new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name", company.SoldToId);
|
||||
|
||||
return View(company);
|
||||
}
|
||||
|
||||
// GET: Admin/Companies/Edit/5
|
||||
public async Task<IActionResult> Edit(int? id)
|
||||
{
|
||||
if(id == null) return NotFound();
|
||||
if(id == null)
|
||||
return NotFound();
|
||||
|
||||
Company company = await _context.Companies.FindAsync(id);
|
||||
if(company == null) return NotFound();
|
||||
|
||||
if(company == null)
|
||||
return NotFound();
|
||||
|
||||
ViewData["CountryId"] =
|
||||
new SelectList(_context.Iso31661Numeric.OrderBy(c => c.Name), "Id", "Name", company.CountryId);
|
||||
|
||||
ViewData["SoldToId"] =
|
||||
new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name", company.SoldToId);
|
||||
|
||||
return View(company);
|
||||
}
|
||||
|
||||
// POST: Admin/Companies/Edit/5
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(
|
||||
int id, [Bind(
|
||||
"Id,Name,Founded,Website,Twitter,Facebook,Sold,SoldToId,Address,City,Province,PostalCode,CountryId,Status")]
|
||||
int id,
|
||||
[Bind("Id,Name,Founded,Website,Twitter,Facebook,Sold,SoldToId,Address,City,Province,PostalCode,CountryId,Status")]
|
||||
Company company)
|
||||
{
|
||||
if(id != company.Id) return NotFound();
|
||||
if(id != company.Id)
|
||||
return NotFound();
|
||||
|
||||
if(ModelState.IsValid)
|
||||
{
|
||||
@@ -148,7 +150,8 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
}
|
||||
catch(DbUpdateConcurrencyException)
|
||||
{
|
||||
if(!CompanyExists(company.Id)) return NotFound();
|
||||
if(!CompanyExists(company.Id))
|
||||
return NotFound();
|
||||
|
||||
throw;
|
||||
}
|
||||
@@ -158,38 +161,39 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
|
||||
ViewData["CountryId"] =
|
||||
new SelectList(_context.Iso31661Numeric.OrderBy(c => c.Name), "Id", "Name", company.CountryId);
|
||||
|
||||
ViewData["SoldToId"] =
|
||||
new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name", company.SoldToId);
|
||||
|
||||
return View(company);
|
||||
}
|
||||
|
||||
// GET: Admin/Companies/Delete/5
|
||||
public async Task<IActionResult> Delete(int? id)
|
||||
{
|
||||
if(id == null) return NotFound();
|
||||
if(id == null)
|
||||
return NotFound();
|
||||
|
||||
Company company = await _context.Companies.Include(c => c.Country).Include(c => c.SoldTo)
|
||||
.FirstOrDefaultAsync(m => m.Id == id);
|
||||
if(company == null) return NotFound();
|
||||
Company company = await _context.Companies.Include(c => c.Country).Include(c => c.SoldTo).
|
||||
FirstOrDefaultAsync(m => m.Id == id);
|
||||
|
||||
if(company == null)
|
||||
return NotFound();
|
||||
|
||||
return View(company);
|
||||
}
|
||||
|
||||
// POST: Admin/Companies/Delete/5
|
||||
[HttpPost]
|
||||
[ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(int id)
|
||||
{
|
||||
Company company = await _context.Companies.FindAsync(id);
|
||||
_context.Companies.Remove(company);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
bool CompanyExists(int id)
|
||||
{
|
||||
return _context.Companies.Any(e => e.Id == id);
|
||||
}
|
||||
bool CompanyExists(int id) => _context.Companies.Any(e => e.Id == id);
|
||||
}
|
||||
}
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Marechai.Database.Models;
|
||||
using Marechai.Areas.Admin.Models;
|
||||
using Marechai.Database.Models;
|
||||
using Markdig;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -41,11 +41,10 @@ using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace Marechai.Areas.Admin.Controllers
|
||||
{
|
||||
[Area("Admin")]
|
||||
[Authorize]
|
||||
[Area("Admin"), Authorize]
|
||||
public class CompanyDescriptionsController : Controller
|
||||
{
|
||||
readonly MarechaiContext _context;
|
||||
readonly MarechaiContext _context;
|
||||
readonly MarkdownPipeline pipeline;
|
||||
|
||||
public CompanyDescriptionsController(MarechaiContext context)
|
||||
@@ -59,22 +58,24 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
{
|
||||
IIncludableQueryable<CompanyDescription, Company> marechaiContext =
|
||||
_context.CompanyDescriptions.Include(c => c.Company);
|
||||
return View(await marechaiContext.OrderBy(c => c.Company.Name)
|
||||
.Select(c => new CompanyDescriptionViewModel
|
||||
{
|
||||
Id = c.Id, Company = c.Company.Name
|
||||
}).ToListAsync());
|
||||
|
||||
return View(await marechaiContext.OrderBy(c => c.Company.Name).Select(c => new CompanyDescriptionViewModel
|
||||
{
|
||||
Id = c.Id, Company = c.Company.Name
|
||||
}).ToListAsync());
|
||||
}
|
||||
|
||||
// GET: CompanyDescription/Details/5
|
||||
public async Task<IActionResult> Details(int? id)
|
||||
{
|
||||
if(id == null) return NotFound();
|
||||
if(id == null)
|
||||
return NotFound();
|
||||
|
||||
CompanyDescription companyDescription = await _context.CompanyDescriptions
|
||||
.Include(c => c.Company)
|
||||
.FirstOrDefaultAsync(m => m.Id == id);
|
||||
if(companyDescription == null) return NotFound();
|
||||
CompanyDescription companyDescription =
|
||||
await _context.CompanyDescriptions.Include(c => c.Company).FirstOrDefaultAsync(m => m.Id == id);
|
||||
|
||||
if(companyDescription == null)
|
||||
return NotFound();
|
||||
|
||||
return View(companyDescription);
|
||||
}
|
||||
@@ -83,14 +84,14 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewData["CompanyId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name");
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: CompanyDescription/Create
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create([Bind("Id,CompanyId,Text")] CompanyDescription companyDescription)
|
||||
{
|
||||
if(ModelState.IsValid)
|
||||
@@ -98,35 +99,41 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
companyDescription.Html = Markdown.ToHtml(companyDescription.Text, pipeline);
|
||||
_context.Add(companyDescription);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
ViewData["CompanyId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name",
|
||||
companyDescription.CompanyId);
|
||||
|
||||
return View(companyDescription);
|
||||
}
|
||||
|
||||
// GET: CompanyDescription/Edit/5
|
||||
public async Task<IActionResult> Edit(int? id)
|
||||
{
|
||||
if(id == null) return NotFound();
|
||||
if(id == null)
|
||||
return NotFound();
|
||||
|
||||
CompanyDescription companyDescription = await _context.CompanyDescriptions.FindAsync(id);
|
||||
if(companyDescription == null) return NotFound();
|
||||
|
||||
if(companyDescription == null)
|
||||
return NotFound();
|
||||
|
||||
ViewData["CompanyId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name",
|
||||
companyDescription.CompanyId);
|
||||
|
||||
return View(companyDescription);
|
||||
}
|
||||
|
||||
// POST: CompanyDescription/Edit/5
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(int id, [Bind("Id,CompanyId,Text")] CompanyDescription companyDescription)
|
||||
{
|
||||
if(id != companyDescription.Id) return NotFound();
|
||||
if(id != companyDescription.Id)
|
||||
return NotFound();
|
||||
|
||||
if(ModelState.IsValid)
|
||||
{
|
||||
@@ -138,7 +145,8 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
}
|
||||
catch(DbUpdateConcurrencyException)
|
||||
{
|
||||
if(!CompanyDescriptionExists(companyDescription.Id)) return NotFound();
|
||||
if(!CompanyDescriptionExists(companyDescription.Id))
|
||||
return NotFound();
|
||||
|
||||
throw;
|
||||
}
|
||||
@@ -148,37 +156,36 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
|
||||
ViewData["CompanyId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name",
|
||||
companyDescription.CompanyId);
|
||||
|
||||
return View(companyDescription);
|
||||
}
|
||||
|
||||
// GET: CompanyDescription/Delete/5
|
||||
public async Task<IActionResult> Delete(int? id)
|
||||
{
|
||||
if(id == null) return NotFound();
|
||||
if(id == null)
|
||||
return NotFound();
|
||||
|
||||
CompanyDescription companyDescription = await _context.CompanyDescriptions
|
||||
.Include(c => c.Company)
|
||||
.FirstOrDefaultAsync(m => m.Id == id);
|
||||
if(companyDescription == null) return NotFound();
|
||||
CompanyDescription companyDescription =
|
||||
await _context.CompanyDescriptions.Include(c => c.Company).FirstOrDefaultAsync(m => m.Id == id);
|
||||
|
||||
if(companyDescription == null)
|
||||
return NotFound();
|
||||
|
||||
return View(companyDescription);
|
||||
}
|
||||
|
||||
// POST: CompanyDescription/Delete/5
|
||||
[HttpPost]
|
||||
[ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(int id)
|
||||
{
|
||||
CompanyDescription companyDescription = await _context.CompanyDescriptions.FindAsync(id);
|
||||
_context.CompanyDescriptions.Remove(companyDescription);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
bool CompanyDescriptionExists(int id)
|
||||
{
|
||||
return _context.CompanyDescriptions.Any(e => e.Id == id);
|
||||
}
|
||||
bool CompanyDescriptionExists(int id) => _context.CompanyDescriptions.Any(e => e.Id == id);
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using Marechai.Database.Models;
|
||||
using Marechai.Areas.Admin.Models;
|
||||
using Marechai.Database.Models;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -17,11 +17,10 @@ using SKSvg = SkiaSharp.Extended.Svg.SKSvg;
|
||||
|
||||
namespace Marechai.Areas.Admin.Controllers
|
||||
{
|
||||
[Area("Admin")]
|
||||
[Authorize]
|
||||
[Area("Admin"), Authorize]
|
||||
public class CompanyLogosController : Controller
|
||||
{
|
||||
readonly MarechaiContext _context;
|
||||
readonly MarechaiContext _context;
|
||||
readonly IHostingEnvironment hostingEnvironment;
|
||||
|
||||
public CompanyLogosController(MarechaiContext context, IHostingEnvironment env)
|
||||
@@ -34,21 +33,25 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
IIncludableQueryable<CompanyLogo, Company> marechaiContext = _context.CompanyLogos.Include(c => c.Company);
|
||||
return View(await marechaiContext.OrderBy(l => l.Company.Name).ThenBy(l => l.Year)
|
||||
.Select(l => new CompanyLogoViewModel
|
||||
{
|
||||
Company = l.Company.Name, Id = l.Id, Year = l.Year
|
||||
}).ToListAsync());
|
||||
|
||||
return View(await marechaiContext.OrderBy(l => l.Company.Name).ThenBy(l => l.Year).
|
||||
Select(l => new CompanyLogoViewModel
|
||||
{
|
||||
Company = l.Company.Name, Id = l.Id, Year = l.Year
|
||||
}).ToListAsync());
|
||||
}
|
||||
|
||||
// GET: CompanyLogos/Details/5
|
||||
public async Task<IActionResult> Details(int? id)
|
||||
{
|
||||
if(id == null) return NotFound();
|
||||
if(id == null)
|
||||
return NotFound();
|
||||
|
||||
CompanyLogo companyLogo = await _context.CompanyLogos
|
||||
.Include(c => c.Company).FirstOrDefaultAsync(m => m.Id == id);
|
||||
if(companyLogo == null) return NotFound();
|
||||
CompanyLogo companyLogo =
|
||||
await _context.CompanyLogos.Include(c => c.Company).FirstOrDefaultAsync(m => m.Id == id);
|
||||
|
||||
if(companyLogo == null)
|
||||
return NotFound();
|
||||
|
||||
return View(companyLogo);
|
||||
}
|
||||
@@ -57,10 +60,11 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
// TODO: Upload
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewData["CompanyId"] =
|
||||
new
|
||||
SelectList(_context.Companies.Select(c => new CompanyViewModel {Name = c.Name, Id = c.Id}).OrderBy(c => c.Name),
|
||||
"Id", "Name");
|
||||
ViewData["CompanyId"] = new SelectList(_context.Companies.Select(c => new CompanyViewModel
|
||||
{
|
||||
Name = c.Name, Id = c.Id
|
||||
}).OrderBy(c => c.Name), "Id", "Name");
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
@@ -68,20 +72,20 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
// TODO: Upload
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create([Bind("Id,CompanyId,Year,SvgLogo")] CompanyLogo companyLogo)
|
||||
{
|
||||
if(!ModelState.IsValid)
|
||||
{
|
||||
ViewData["CompanyId"] =
|
||||
new
|
||||
SelectList(_context.Companies.Select(c => new CompanyViewModel {Name = c.Name, Id = c.Id}).OrderBy(c => c.Name),
|
||||
"Id", "Name", companyLogo.CompanyId);
|
||||
ViewData["CompanyId"] = new SelectList(_context.Companies.Select(c => new CompanyViewModel
|
||||
{
|
||||
Name = c.Name, Id = c.Id
|
||||
}).OrderBy(c => c.Name), "Id", "Name", companyLogo.CompanyId);
|
||||
|
||||
return View(companyLogo);
|
||||
}
|
||||
|
||||
using(MemoryStream svgMs = new MemoryStream())
|
||||
using(var svgMs = new MemoryStream())
|
||||
{
|
||||
await companyLogo.SvgLogo.CopyToAsync(svgMs);
|
||||
|
||||
@@ -89,9 +93,9 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
StreamReader sr = new StreamReader(svgMs, Encoding.UTF8);
|
||||
string svgStr = await sr.ReadToEndAsync();
|
||||
XmlDocument xml = new XmlDocument();
|
||||
var sr = new StreamReader(svgMs, Encoding.UTF8);
|
||||
string svgStr = await sr.ReadToEndAsync();
|
||||
var xml = new XmlDocument();
|
||||
xml.LoadXml(svgStr);
|
||||
}
|
||||
catch(XmlException)
|
||||
@@ -99,10 +103,11 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
companyLogo.SvgLogo = null;
|
||||
companyLogo.ErrorMessage = "Not a valid SVG file.";
|
||||
|
||||
ViewData["CompanyId"] =
|
||||
new
|
||||
SelectList(_context.Companies.Select(c => new CompanyViewModel {Name = c.Name, Id = c.Id}).OrderBy(c => c.Name),
|
||||
"Id", "Name", companyLogo.CompanyId);
|
||||
ViewData["CompanyId"] = new SelectList(_context.Companies.Select(c => new CompanyViewModel
|
||||
{
|
||||
Name = c.Name, Id = c.Id
|
||||
}).OrderBy(c => c.Name), "Id", "Name", companyLogo.CompanyId);
|
||||
|
||||
return View(companyLogo);
|
||||
}
|
||||
|
||||
@@ -111,19 +116,21 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
|
||||
string vectorial = Path.Combine(hostingEnvironment.WebRootPath, "assets/logos",
|
||||
companyLogo.Guid + ".svg");
|
||||
|
||||
if(System.IO.File.Exists(vectorial))
|
||||
{
|
||||
companyLogo.SvgLogo = null;
|
||||
companyLogo.ErrorMessage = "GUID clash, please retry and report to the administrator.";
|
||||
|
||||
ViewData["CompanyId"] =
|
||||
new
|
||||
SelectList(_context.Companies.Select(c => new CompanyViewModel {Name = c.Name, Id = c.Id}).OrderBy(c => c.Name),
|
||||
"Id", "Name", companyLogo.CompanyId);
|
||||
ViewData["CompanyId"] = new SelectList(_context.Companies.Select(c => new CompanyViewModel
|
||||
{
|
||||
Name = c.Name, Id = c.Id
|
||||
}).OrderBy(c => c.Name), "Id", "Name", companyLogo.CompanyId);
|
||||
|
||||
return View(companyLogo);
|
||||
}
|
||||
|
||||
FileStream outSvg = new FileStream(vectorial, FileMode.CreateNew);
|
||||
var outSvg = new FileStream(vectorial, FileMode.CreateNew);
|
||||
await svgMs.CopyToAsync(outSvg);
|
||||
svgMs.Position = 0;
|
||||
|
||||
@@ -131,28 +138,39 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
foreach(string format in new[] {"png", "webp"})
|
||||
foreach(string format in new[]
|
||||
{
|
||||
if(!Directory.Exists(Path.Combine(hostingEnvironment.WebRootPath, "assets/logos", format))) ;
|
||||
"png", "webp"
|
||||
})
|
||||
{
|
||||
if(!Directory.Exists(Path.Combine(hostingEnvironment.WebRootPath, "assets/logos", format)))
|
||||
;
|
||||
|
||||
Directory.CreateDirectory(Path.Combine(hostingEnvironment.WebRootPath, "assets/logos", format));
|
||||
|
||||
SKEncodedImageFormat skFormat;
|
||||
|
||||
switch(format)
|
||||
{
|
||||
case "webp":
|
||||
case"webp":
|
||||
skFormat = SKEncodedImageFormat.Webp;
|
||||
|
||||
break;
|
||||
default:
|
||||
skFormat = SKEncodedImageFormat.Png;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
foreach(int multiplier in new[] {1, 2, 3})
|
||||
foreach(int multiplier in new[]
|
||||
{
|
||||
1, 2, 3
|
||||
})
|
||||
{
|
||||
if(!Directory.Exists(Path.Combine(hostingEnvironment.WebRootPath, "assets/logos", format,
|
||||
$"{multiplier}x")))
|
||||
Directory.CreateDirectory(Path.Combine(hostingEnvironment.WebRootPath, "assets/logos",
|
||||
format, $"{multiplier}x"));
|
||||
Directory.CreateDirectory(Path.Combine(hostingEnvironment.WebRootPath, "assets/logos",
|
||||
format, $"{multiplier}x"));
|
||||
|
||||
string rendered = Path.Combine(hostingEnvironment.WebRootPath, "assets/logos", format,
|
||||
$"{multiplier}x", companyLogo.Guid + $".{format}");
|
||||
@@ -163,29 +181,34 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
companyLogo.ErrorMessage = "GUID clash, please retry and report to the administrator.";
|
||||
|
||||
ViewData["CompanyId"] =
|
||||
new
|
||||
SelectList(_context.Companies.Select(c => new CompanyViewModel {Name = c.Name, Id = c.Id}).OrderBy(c => c.Name),
|
||||
"Id", "Name", companyLogo.CompanyId);
|
||||
new SelectList(_context.Companies.Select(c => new CompanyViewModel
|
||||
{
|
||||
Name = c.Name, Id = c.Id
|
||||
}).OrderBy(c => c.Name), "Id", "Name", companyLogo.CompanyId);
|
||||
|
||||
return View(companyLogo);
|
||||
}
|
||||
|
||||
Console.WriteLine("Rendering {0}", rendered);
|
||||
|
||||
if(svg == null)
|
||||
{
|
||||
svg = new SKSvg();
|
||||
svg.Load(svgMs);
|
||||
}
|
||||
|
||||
SKRect svgSize = svg.Picture.CullRect;
|
||||
SKMatrix matrix = SKMatrix.MakeScale(multiplier, multiplier);
|
||||
SKBitmap bitmap = new SKBitmap((int)(svgSize.Width * multiplier),
|
||||
(int)(svgSize.Height * multiplier));
|
||||
SKCanvas canvas = new SKCanvas(bitmap);
|
||||
SKRect svgSize = svg.Picture.CullRect;
|
||||
var matrix = SKMatrix.MakeScale(multiplier, multiplier);
|
||||
|
||||
var bitmap = new SKBitmap((int)(svgSize.Width * multiplier),
|
||||
(int)(svgSize.Height * multiplier));
|
||||
|
||||
var canvas = new SKCanvas(bitmap);
|
||||
canvas.DrawPicture(svg.Picture, ref matrix);
|
||||
canvas.Flush();
|
||||
SKImage image = SKImage.FromBitmap(bitmap);
|
||||
SKData data = image.Encode(skFormat, 100);
|
||||
FileStream outfs = new FileStream(rendered, FileMode.CreateNew);
|
||||
var image = SKImage.FromBitmap(bitmap);
|
||||
SKData data = image.Encode(skFormat, 100);
|
||||
var outfs = new FileStream(rendered, FileMode.CreateNew);
|
||||
data.SaveTo(outfs);
|
||||
outfs.Close();
|
||||
|
||||
@@ -193,30 +216,40 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
foreach(string format in new[] {"png", "webp"})
|
||||
foreach(string format in new[]
|
||||
{
|
||||
"png", "webp"
|
||||
})
|
||||
{
|
||||
if(!Directory.Exists(Path.Combine(hostingEnvironment.WebRootPath, "assets/logos/thumbs",
|
||||
format)))
|
||||
Directory.CreateDirectory(Path.Combine(hostingEnvironment.WebRootPath, "assets/logos/thumbs",
|
||||
format));
|
||||
Directory.CreateDirectory(Path.Combine(hostingEnvironment.WebRootPath,
|
||||
"assets/logos/thumbs", format));
|
||||
|
||||
SKEncodedImageFormat skFormat;
|
||||
|
||||
switch(format)
|
||||
{
|
||||
case "webp":
|
||||
case"webp":
|
||||
skFormat = SKEncodedImageFormat.Webp;
|
||||
|
||||
break;
|
||||
default:
|
||||
skFormat = SKEncodedImageFormat.Png;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
foreach(int multiplier in new[] {1, 2, 3})
|
||||
foreach(int multiplier in new[]
|
||||
{
|
||||
1, 2, 3
|
||||
})
|
||||
{
|
||||
if(!Directory.Exists(Path.Combine(hostingEnvironment.WebRootPath, "assets/logos/thumbs",
|
||||
format, $"{multiplier}x")))
|
||||
Directory.CreateDirectory(Path.Combine(hostingEnvironment.WebRootPath,
|
||||
"assets/logos/thumbs", format, $"{multiplier}x"));
|
||||
Directory.CreateDirectory(Path.Combine(hostingEnvironment.WebRootPath,
|
||||
"assets/logos/thumbs", format,
|
||||
$"{multiplier}x"));
|
||||
|
||||
string rendered = Path.Combine(hostingEnvironment.WebRootPath, "assets/logos/thumbs",
|
||||
format, $"{multiplier}x", companyLogo.Guid + $".{format}");
|
||||
@@ -227,32 +260,37 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
companyLogo.ErrorMessage = "GUID clash, please retry and report to the administrator.";
|
||||
|
||||
ViewData["CompanyId"] =
|
||||
new
|
||||
SelectList(_context.Companies.Select(c => new CompanyViewModel {Name = c.Name, Id = c.Id}).OrderBy(c => c.Name),
|
||||
"Id", "Name", companyLogo.CompanyId);
|
||||
new SelectList(_context.Companies.Select(c => new CompanyViewModel
|
||||
{
|
||||
Name = c.Name, Id = c.Id
|
||||
}).OrderBy(c => c.Name), "Id", "Name", companyLogo.CompanyId);
|
||||
|
||||
return View(companyLogo);
|
||||
}
|
||||
|
||||
Console.WriteLine("Rendering {0}", rendered);
|
||||
|
||||
if(svg == null)
|
||||
{
|
||||
svg = new SKSvg();
|
||||
svg.Load(svgMs);
|
||||
}
|
||||
|
||||
SKRect svgSize = svg.Picture.CullRect;
|
||||
float svgMax = Math.Max(svgSize.Width, svgSize.Height);
|
||||
float canvasMin = 32 * multiplier;
|
||||
float scale = canvasMin / svgMax;
|
||||
SKMatrix matrix = SKMatrix.MakeScale(scale, scale);
|
||||
SKBitmap bitmap =
|
||||
SKRect svgSize = svg.Picture.CullRect;
|
||||
float svgMax = Math.Max(svgSize.Width, svgSize.Height);
|
||||
float canvasMin = 32 * multiplier;
|
||||
float scale = canvasMin / svgMax;
|
||||
var matrix = SKMatrix.MakeScale(scale, scale);
|
||||
|
||||
var bitmap =
|
||||
new SKBitmap((int)(svgSize.Width * scale), (int)(svgSize.Height * scale));
|
||||
SKCanvas canvas = new SKCanvas(bitmap);
|
||||
|
||||
var canvas = new SKCanvas(bitmap);
|
||||
canvas.DrawPicture(svg.Picture, ref matrix);
|
||||
canvas.Flush();
|
||||
SKImage image = SKImage.FromBitmap(bitmap);
|
||||
SKData data = image.Encode(skFormat, 100);
|
||||
FileStream outfs = new FileStream(rendered, FileMode.CreateNew);
|
||||
var image = SKImage.FromBitmap(bitmap);
|
||||
SKData data = image.Encode(skFormat, 100);
|
||||
var outfs = new FileStream(rendered, FileMode.CreateNew);
|
||||
data.SaveTo(outfs);
|
||||
outfs.Close();
|
||||
|
||||
@@ -263,36 +301,42 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
catch(IOException e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
_context.Add(companyLogo);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
// GET: CompanyLogos/Edit/5
|
||||
public async Task<IActionResult> Edit(int? id)
|
||||
{
|
||||
if(id == null) return NotFound();
|
||||
if(id == null)
|
||||
return NotFound();
|
||||
|
||||
CompanyLogo companyLogo = await _context.CompanyLogos.FirstOrDefaultAsync(c => c.Id == id);
|
||||
if(companyLogo == null) return NotFound();
|
||||
|
||||
if(companyLogo == null)
|
||||
return NotFound();
|
||||
|
||||
ViewData["CompanyId"] =
|
||||
new SelectList(_context.Companies.OrderBy(l => l.Name), "Id", "Name", companyLogo.CompanyId);
|
||||
|
||||
return View(companyLogo);
|
||||
}
|
||||
|
||||
// POST: CompanyLogos/Edit/5
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(int id, [Bind("Id,CompanyId,Year,Guid")] CompanyLogo companyLogo)
|
||||
{
|
||||
if(id != companyLogo.Id) return NotFound();
|
||||
if(id != companyLogo.Id)
|
||||
return NotFound();
|
||||
|
||||
if(ModelState.IsValid)
|
||||
{
|
||||
@@ -303,7 +347,8 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
}
|
||||
catch(DbUpdateConcurrencyException)
|
||||
{
|
||||
if(!CompanyLogoExists(companyLogo.Id)) return NotFound();
|
||||
if(!CompanyLogoExists(companyLogo.Id))
|
||||
return NotFound();
|
||||
|
||||
throw;
|
||||
}
|
||||
@@ -313,38 +358,40 @@ namespace Marechai.Areas.Admin.Controllers
|
||||
|
||||
ViewData["CompanyId"] =
|
||||
new SelectList(_context.Companies.OrderBy(l => l.Name), "Id", "Name", companyLogo.CompanyId);
|
||||
|
||||
return View(companyLogo);
|
||||
}
|
||||
|
||||
// GET: CompanyLogos/Delete/5
|
||||
public async Task<IActionResult> Delete(int? id)
|
||||
{
|
||||
if(id == null) return NotFound();
|
||||
if(id == null)
|
||||
return NotFound();
|
||||
|
||||
CompanyLogo companyLogo = await _context.CompanyLogos
|
||||
.Include(c => c.Company).FirstOrDefaultAsync(m => m.Id == id);
|
||||
if(companyLogo == null) return NotFound();
|
||||
CompanyLogo companyLogo =
|
||||
await _context.CompanyLogos.Include(c => c.Company).FirstOrDefaultAsync(m => m.Id == id);
|
||||
|
||||
if(companyLogo == null)
|
||||
return NotFound();
|
||||
|
||||
return View(companyLogo);
|
||||
}
|
||||
|
||||
// POST: CompanyLogos/Delete/5
|
||||
[HttpPost]
|
||||
[ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(int id)
|
||||
{
|
||||
CompanyLogo companyLogo = await _context.CompanyLogos.FirstOrDefaultAsync(m => m.Id == id);
|
||||
if(companyLogo == null) return NotFound();
|
||||
|
||||
if(companyLogo == null)
|
||||
return NotFound();
|
||||
|
||||
_context.CompanyLogos.Remove(companyLogo);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
bool CompanyLogoExists(int id)
|
||||
{
|
||||
return _context.CompanyLogos.Any(e => e.Id == id);
|
||||
}
|
||||
bool CompanyLogoExists(int id) => _context.CompanyLogos.Any(e => e.Id == id);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user