Fix Models with PLZ

This commit is contained in:
2023-03-14 11:12:19 +01:00
parent 76b1a3de75
commit b5f6adc41c
19 changed files with 69 additions and 123 deletions

View File

@ -1,39 +1,32 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WGneu.Helpers;
namespace WGneu.Models {
[Table("AT_plz"), PrimaryKey("Plz", "Okz"), Index("Id", IsUnique = true)]
[Table("AT_plz"), PrimaryKey("Plz")]
public class AT_Plz {
[Column("plz")]
public int Plz { get; set; }
[Column("okz")]
public int Okz { get; set; }
[Column("ort")]
public string Ort { get; set; }
[Column("country")]
public string CountryCode { get; }
[Column("blnr")]
public int BlNr { get; }
[Column("id")]
public string Id { get; }
[Column("type")]
public string Type { get; }
[Column("dest")]
public string Dest { get; set; }
[Column("internal")]
public bool Internal { get; set; }
[ForeignKey("Okz")]
public virtual AT_Ort Ort { get; set; }
[Column("addressable")]
public bool Addressable { get; set; }
[ForeignKey("CountryCode")]
public virtual Country Country { get; set; }
[Column("po_box")]
public bool PoBox { get; set; }
public ISet<AT_Plz> Orte(AppDbContext ctx) {
return ctx.Postleitzahlen.Where(p => p.Plz == Plz).ToHashSet();
}
[InverseProperty("AtPlz")]
public virtual ISet<AT_PlzDest> Orte { get; set; }
}
}