2022-11-01 12:24:04 -04:00
|
|
|
|
using GrossesMitainesAPI.Data;
|
|
|
|
|
using System.Collections.Generic;
|
2022-11-01 13:33:08 -04:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2022-11-01 12:24:04 -04:00
|
|
|
|
|
|
|
|
|
namespace GrossesMitainesAPI.Models;
|
|
|
|
|
public class InvoiceModel {
|
2022-11-02 21:00:48 -04:00
|
|
|
|
public enum InStates {
|
|
|
|
|
Confirmed,
|
|
|
|
|
Cancelled,
|
|
|
|
|
Preparing,
|
|
|
|
|
Shipping,
|
|
|
|
|
Shipped,
|
2022-11-08 06:31:10 -05:00
|
|
|
|
Returned,
|
|
|
|
|
Pending
|
2022-11-02 21:00:48 -04:00
|
|
|
|
}
|
2022-11-01 13:33:08 -04:00
|
|
|
|
public class ProductInvoice {
|
|
|
|
|
[Key]
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
public ProductModel Product { get; set; }
|
2022-11-02 21:00:48 -04:00
|
|
|
|
public uint Quantity { get; set; }
|
2022-11-01 13:33:08 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[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; }
|
2022-11-02 21:00:48 -04:00
|
|
|
|
public DateTime PurchaseDate { get; set; } = DateTime.Now;
|
2022-11-01 13:33:08 -04:00
|
|
|
|
[Required]
|
|
|
|
|
public List<ProductInvoice> Products { get; set; }
|
|
|
|
|
[Required]
|
|
|
|
|
public AddressModel ShippingAddress { get; set; }
|
2022-11-02 21:00:48 -04:00
|
|
|
|
public InStates Status { get; set; } = InStates.Confirmed;
|
2022-12-04 12:10:10 -05:00
|
|
|
|
public ChargesModel? Payment { get; set; } // Pour enregistrer le paiement.
|
2022-11-04 18:22:24 -04:00
|
|
|
|
|
|
|
|
|
public InvoiceModel() { }
|
|
|
|
|
public InvoiceModel(SendInvoiceModel sinv) {
|
|
|
|
|
FirstName = sinv.FirstName;
|
|
|
|
|
LastName = sinv.LastName;
|
|
|
|
|
PhoneNumber = sinv.PhoneNumber;
|
|
|
|
|
EmailAddress = sinv.EmailAddress;
|
|
|
|
|
}
|
2022-11-01 12:24:04 -04:00
|
|
|
|
}
|
|
|
|
|
|