-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Order and OrderItem entities. related #2
- Loading branch information
Showing
3 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using PetStore.Core.DomainObjects.Payment; | ||
using PetStore.Core.DomainObjects.Security; | ||
|
||
namespace PetStore.Core.DomainObjects.Foundation | ||
{ | ||
/// <summary> | ||
/// Order entity | ||
/// </summary> | ||
public class Order | ||
{ | ||
#region Public Properties | ||
|
||
/// <summary> | ||
/// Order ID | ||
/// </summary> | ||
public virtual int Id { get; set; } | ||
|
||
/// <summary> | ||
/// Order user | ||
/// </summary> | ||
public virtual User User { get; set;} | ||
|
||
/// <summary> | ||
/// Credit card used to pay the order | ||
/// </summary> | ||
public virtual CreditCard CreditCard { get; set; } | ||
|
||
/// <summary> | ||
/// Order billing address | ||
/// </summary> | ||
public virtual Address BillingAddress { get; set; } | ||
|
||
/// <summary> | ||
/// Order shipping address | ||
/// </summary> | ||
public virtual Address ShippingAddress { get; set; } | ||
|
||
/// <summary> | ||
/// Order items | ||
/// </summary> | ||
public virtual IList<OrderItem> Items { get; set; } | ||
|
||
/// <summary> | ||
/// Order total | ||
/// </summary> | ||
public virtual decimal Total { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Credit card authorization number | ||
/// TODO - It must be on CreditCardPayment entity | ||
/// </summary> | ||
public virtual int? AuthorizationNumber { get; set; } | ||
|
||
/// <summary> | ||
/// Order creation date | ||
/// </summary> | ||
public virtual DateTime CreatedAt { get; set; } | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
namespace PetStore.Core.DomainObjects.Foundation | ||
{ | ||
/// <summary> | ||
/// Order item entity | ||
/// </summary> | ||
public class OrderItem | ||
{ | ||
#region Public Properties | ||
|
||
/// <summary> | ||
/// Order item ID | ||
/// </summary> | ||
public virtual int Id { get; set; } | ||
|
||
/// <summary> | ||
/// Order that contains this item | ||
/// </summary> | ||
public virtual Order Order { get; set; } | ||
|
||
/// <summary> | ||
/// Product | ||
/// </summary> | ||
public virtual Product Product { get; set; } | ||
|
||
/// <summary> | ||
/// Product quantity | ||
/// </summary> | ||
public virtual int Quantity { get; set; } | ||
|
||
/// <summary> | ||
/// Product price | ||
/// </summary> | ||
public virtual decimal Price { get; set; } | ||
|
||
/// <summary> | ||
/// Order item subtotal | ||
/// </summary> | ||
public virtual decimal SubTotal | ||
{ | ||
get | ||
{ | ||
return Quantity*Price; | ||
} | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters