87 lines
1.9 KiB
C#
87 lines
1.9 KiB
C#
namespace SampleApi.Models
|
|
{
|
|
public enum UserRole
|
|
{
|
|
Admin,
|
|
Member,
|
|
Guest
|
|
}
|
|
|
|
public class User
|
|
{
|
|
|
|
public Guid Id { get; set; }
|
|
|
|
public string Name { get; set; } = "";
|
|
|
|
public string Email { get; set; } = "";
|
|
|
|
public UserRole Role { get; set; }
|
|
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
public Address? Address { get; set; }
|
|
|
|
public List<string> Tags { get; set; } = new();
|
|
}
|
|
|
|
public class Address
|
|
{
|
|
public string Street { get; set; } = "";
|
|
public string City { get; set; } = "";
|
|
public string PostalCode { get; set; } = "";
|
|
public string Country { get; set; } = "";
|
|
}
|
|
|
|
public class CreateUserRequest
|
|
{
|
|
|
|
public string Name { get; set; } = "";
|
|
|
|
public string Email { get; set; } = "";
|
|
|
|
public UserRole Role { get; set; } = UserRole.Member;
|
|
|
|
public Address? Address { get; set; }
|
|
}
|
|
|
|
public class UpdateUserRequest
|
|
{
|
|
public string? Name { get; set; }
|
|
public string? Email { get; set; }
|
|
public UserRole? Role { get; set; }
|
|
}
|
|
|
|
public class Order
|
|
{
|
|
public Guid Id { get; set; }
|
|
public Guid UserId { get; set; }
|
|
public List<OrderLine> Lines { get; set; } = new();
|
|
public decimal Total { get; set; }
|
|
public OrderStatus Status { get; set; }
|
|
public DateTime PlacedAt { get; set; }
|
|
}
|
|
|
|
public class OrderLine
|
|
{
|
|
public string Sku { get; set; } = "";
|
|
public int Quantity { get; set; }
|
|
public decimal UnitPrice { get; set; }
|
|
}
|
|
|
|
public enum OrderStatus
|
|
{
|
|
Pending,
|
|
Paid,
|
|
Shipped,
|
|
Delivered,
|
|
Cancelled
|
|
}
|
|
|
|
public class CreateOrderRequest
|
|
{
|
|
public Guid UserId { get; set; }
|
|
public List<OrderLine> Lines { get; set; } = new();
|
|
}
|
|
}
|