mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-06 21:10:55 +00:00
Подключил blazor к api, теперь для работы АИС, достаточно запустить backend
This commit is contained in:
1 parent
d1ea7b812c
commit
213c590e95
36 files changed
+26
-870
No files matched your search
@@ -1,59 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CartriX.Api.Classes
|
||||
{
|
||||
public class AppDbContext : DbContext
|
||||
{
|
||||
public AppDbContext(DbContextOptions options) : base(options) { }
|
||||
|
||||
public DbSet<Entities.Printer> Printers { get; set; }
|
||||
public DbSet<Entities.Article> Articles { get; set; }
|
||||
public DbSet<Entities.PrinterModel> PrinterModels { get; set; }
|
||||
public DbSet<Entities.ConnetctionType> ConnectionTypes { get; set; }
|
||||
public DbSet<Entities.Location> Locations { get; set; }
|
||||
public DbSet<Entities.Cartridge> Cartridges { get; set; }
|
||||
public DbSet<Entities.CartridgeModel> CartridgeModels { get; set; }
|
||||
public DbSet<Entities.PrintType> PrintTypes { get; set; }
|
||||
public DbSet<Entities.PrinterStatus> PrinterStatuses { get; set; }
|
||||
public DbSet<Entities.CartridgeStatus> CartridgeStatuses { get; set; }
|
||||
public DbSet<Entities.PrinterCounterRecord> PrinterCounterRecord { get; set; }
|
||||
public DbSet<Entities.Manufacturer> Manufacturers { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
|
||||
modelBuilder.Entity<Entities.Location>().HasIndex(l => l.name).IsUnique();
|
||||
|
||||
modelBuilder.Entity<Entities.PrintType>().HasData(
|
||||
new Entities.PrintType { id = 1, name = "Лазерный" },
|
||||
new Entities.PrintType { id = 2, name = "Струйный" }
|
||||
);
|
||||
modelBuilder.Entity<Entities.CartridgeStatus>().HasData(
|
||||
new Entities.CartridgeStatus { id = 1, name = "" },
|
||||
new Entities.CartridgeStatus { id = 2, name = "InStock" },
|
||||
new Entities.CartridgeStatus { id = 3, name = "Refilling" },
|
||||
new Entities.CartridgeStatus { id = 4, name = "InlineRefilling" },
|
||||
new Entities.CartridgeStatus { id = 5, name = "UnderRepair" }
|
||||
);
|
||||
modelBuilder.Entity<Entities.PrinterStatus>().HasData(
|
||||
new Entities.PrinterStatus { id = 1, name = "Активный" },
|
||||
new Entities.PrinterStatus { id = 2, name = "Недоступен" },
|
||||
new Entities.PrinterStatus { id = 3, name = "В ремонте" }
|
||||
);
|
||||
modelBuilder.Entity<Entities.ConnetctionType>().HasData(
|
||||
new Entities.ConnetctionType { id = 1, name = "Сетевой" },
|
||||
new Entities.ConnetctionType { id = 2, name = "USB" }
|
||||
);
|
||||
|
||||
modelBuilder.Entity<Entities.Manufacturer>().HasData(
|
||||
new Entities.Manufacturer { id = 1, name = "Неизвестен" }
|
||||
);
|
||||
|
||||
modelBuilder.Entity<Entities.Cartridge>().Property(p => p.statusId).HasDefaultValue("2");
|
||||
modelBuilder.Entity<Entities.Printer>().Property(p => p.statusId).HasDefaultValue("1");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user