Web API for the bulk printing desktop application.

ProductCatalogue.cs 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Collections.Generic;
  2. namespace MAX.Models
  3. {
  4. public class ProductCatalogue
  5. {
  6. public Network AddNetwork(int id, string name)
  7. {
  8. var network = new Network()
  9. {
  10. Id = id,
  11. Name = name
  12. };
  13. Networks.Add(network);
  14. NetworkMap.Add(id, network);
  15. return network;
  16. }
  17. public Product AddProduct(Network network, int id, decimal faceValue, string description,
  18. Batch.Vouchertype voucherType, decimal discountPercentage)
  19. {
  20. var product = new Product()
  21. {
  22. Id = id,
  23. Network = network,
  24. FaceValue = faceValue,
  25. Description = description,
  26. VoucherType = voucherType,
  27. DiscountPercentage = discountPercentage
  28. };
  29. network.Products.Add(product);
  30. ProductMap.Add(id, product);
  31. return product;
  32. }
  33. public List<Network> Networks { get; set; } = new List<Network>();
  34. public Dictionary<int, Network> NetworkMap { get; set; } = new Dictionary<int, Network>();
  35. public Dictionary<int, Product> ProductMap { get; set; } = new Dictionary<int, Product>();
  36. }
  37. }