Esempio n. 1
0
 /// <summary>
 /// Paameters constructor
 /// </summary>
 /// <param name="id"></param>
 /// <param name="Status"></param>
 /// <param name="Items"></param>
 /// <param name="Date"></param>
 /// <param name="User"></param>
 public Order(int id, Status Status, IEnumerable <IItem> Items, DateTime Date, RegisteredUser User)
 {
     this.Id     = id;
     this.Status = Status;
     this.Items  = Items;
     this.Date   = Date;
     this.User   = User;
 }
        /// <summary>
        /// Add new <see cref="Order"/> by parameters
        /// </summary>
        /// <param name="status"></param>
        /// <param name="items"></param>
        /// <param name="date"></param>
        /// <param name="user"></param>
        public static void AddOrder(Status status, IEnumerable <IItem> items, DateTime date, RegisteredUser user)
        {
            if (date == default || user is null || ((IList <IItem>)items).Equals(null))
            {
                throw new ArgumentNullException("date");
            }

            ((IList <Order>)Orders).Add(new Order(GetLastId(), status, items, date, user));
        }