Last active
December 24, 2015 09:29
-
-
Save shadeglare/6777934 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using MongoDB.Bson; | |
using MongoDB.Driver; | |
namespace Travel.Modelling | |
{ | |
public sealed class Customer | |
{ | |
public ObjectId Id { get; set; } | |
public String FirstName { get; set; } | |
public String LastName { get; set; } | |
public String Email { get; set; } | |
public DateTime BirthDate { get; set; } | |
} | |
public enum ProductType | |
{ | |
Avia, | |
Train, | |
Hotel, | |
} | |
public sealed class Product | |
{ | |
public ObjectId Id { get; set; } | |
public ProductType ProductType { get; set; } | |
public Single Price { get; set; } | |
public String Details { get; set; } | |
public List<MongoDBRef> Customers { get; set; } | |
} | |
public enum OrderStatus | |
{ | |
Pending, | |
Processing, | |
PartiallyFinished, | |
Finished, | |
Failed, | |
} | |
public sealed class Order | |
{ | |
public ObjectId Id { get; set; } | |
public OrderStatus Status { get; set; } | |
public List<MongoDBRef> Products { get; set; } | |
} | |
public interface ICustomerService | |
{ | |
Customer AddCustomer(Customer customer); | |
Customer UpdateCustomer(Customer customer); | |
void DeleteCustomer(Customer customer); | |
} | |
public interface IProductService | |
{ | |
Product FindProduct(ProductType type); | |
} | |
public interface IOrderService | |
{ | |
Order CreateOrder(List<Product> products); | |
Order AddProducts(ObjectId orderId, List<Product> products); | |
Order RemoveProducts(ObjectId orderId, List<Product> products); | |
void ProcessOrder(ObjectId orderId); | |
void CancelOrder(ObjectId orderId); | |
} | |
public interface ITravelPlatform | |
{ | |
ICustomerService CustomerService { get; set; } | |
IProductService ProductService { get; set; } | |
IOrderService OrderService { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment