GGMM/GrossesMitaines/GrossesMitainesAPI/Models/AddressModel.cs

34 lines
1.2 KiB
C#
Raw Normal View History

using System.ComponentModel.DataAnnotations;
namespace GrossesMitainesAPI.Models;
public class AddressModel {
[Key]
2022-11-04 18:22:24 -04:00
public int Id { get; set; } = 0;
[Required, Range(1, int.MaxValue)]
public int CivicNumber { get; set; }
public string? Appartment { get; set; }
[Required, MinLength(3), MaxLength(50)]
public string Street { get; set; }
[Required, MinLength(4), MaxLength(50)]
public string City { get; set; }
[Required, MaxLength(3)]
public string Province { get; set; }
[Required, MinLength(4), MaxLength(30)]
public string Country { get; set; }
// Source pour regex: https://stackoverflow.com/questions/15774555/efficient-regex-for-canadian-postal-code-function
2022-11-03 12:45:59 -04:00
//[Required, RegularExpression(@"/^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i")]
public string PostalCode { get; set; }
2022-11-04 18:22:24 -04:00
public AddressModel() { }
public AddressModel(SendInvoiceModel sinv) {
CivicNumber = sinv.CivicNumber;
Appartment = sinv.Appartment;
Street = sinv.Street;
City = sinv.City;
Province = sinv.Province;
Country = sinv.Country;
PostalCode = sinv.PostalCode;
}
}