GGMM/GrossesMitaines/GrossesMitainesAPI/Models/InvoiceModel.cs
2022-12-04 08:28:12 -08:00

52 lines
1.5 KiB
C#

using GrossesMitainesAPI.Data;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace GrossesMitainesAPI.Models;
public class InvoiceModel {
public enum InStates {
Confirmed,
Cancelled,
Preparing,
Shipping,
Shipped,
Returned,
Pending
}
public class ProductInvoice {
[Key]
public int Id { get; set; }
public ProductModel Product { get; set; }
public uint Quantity { get; set; }
}
[Key]
public int Id { get; set; }
[Required, MinLength(2), MaxLength(30)]
public string FirstName { get; set; }
[Required, MinLength(1), MaxLength(30)]
public string LastName { get; set; }
[Required, Phone]
public string PhoneNumber { get; set; }
[Required, EmailAddress]
public string EmailAddress { get; set; }
public InventoryUser? LinkedAccount { get; set; }
public DateTime PurchaseDate { get; set; } = DateTime.Now;
[Required]
public List<ProductInvoice> Products { get; set; }
[Required]
public AddressModel ShippingAddress { get; set; }
public InStates Status { get; set; } = InStates.Confirmed;
public ChargesModel Payment { get; set; } // Pour enregistrer le paiement.
public InvoiceModel() { }
public InvoiceModel(SendInvoiceModel sinv) {
FirstName = sinv.FirstName;
LastName = sinv.LastName;
PhoneNumber = sinv.PhoneNumber;
EmailAddress = sinv.EmailAddress;
}
}