30 lines
757 B
C#
30 lines
757 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)
|
|
{
|
|
if (CountryCode != "AT") return null;
|
|
return ctx.Postleitzahlen.Where(p => p.Id == Id).FirstOrDefault();
|
|
}
|
|
}
|
|
}
|