28 lines
772 B
C#
28 lines
772 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace WGneu.Models {
|
|
[Table("postal_dest"), PrimaryKey("CountryCode", "Id")]
|
|
public class PostalDest {
|
|
[Column("country")]
|
|
public string CountryCode { get; set; }
|
|
|
|
[Column("id")]
|
|
public string Id { get; set; }
|
|
|
|
[ForeignKey("CountryCode")]
|
|
public virtual Country Country { get; set; }
|
|
|
|
public AT_Plz? Plz(WgContext ctx) {
|
|
// TODO getter
|
|
if (CountryCode != "AT") return null;
|
|
return ctx.Postleitzahlen.Where(p => p.Id == Id).FirstOrDefault();
|
|
}
|
|
}
|
|
}
|