using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebApplication6.Models
{
    public class Orders
    {
        private readonly List<Order> orders = new List<Order>();
        private int nextId = -1;

        public Orders()
        {
            Add(new Order() { LastName = "Federer", TotalAmount = 1023.23m, TotalAmountUsd = 400.23m, OrderCurrencyCode = "SEK", OrderCurrencyCultureCode = "sv-SE", OrderDate = DateTime.UtcNow.AddDays(-1) });
            // Add lots of data here........
            Add(new Order() { LastName = "Aikemo", TotalAmount = 1023.23m, TotalAmountUsd = 400.23m, OrderCurrencyCode = "JPY", OrderCurrencyCultureCode = "ja-JP", OrderDate = DateTime.UtcNow.AddDays(-8) });
        }

        public Order Add(Order item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            item.Id = nextId++;
            orders.Add(item);
            return item;
        }

        public List<Order> GetAll()
        {
            return orders;
        }
    }
}
