示例#1
0
        public ShoppingListItemReadModel(ItemId id, string name, bool isDeleted, string comment,
                                         bool isTemporary, float pricePerQuantity, QuantityTypeReadModel quantityType, float quantityInPacket,
                                         QuantityTypeInPacketReadModel quantityTypeInPacket,
                                         ItemCategoryReadModel itemCategory, ManufacturerReadModel manufacturer,
                                         bool isInBasket, float quantity)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new System.ArgumentException($"'{nameof(name)}' cannot be null or whitespace", nameof(name));
            }

            Id                   = id ?? throw new System.ArgumentNullException(nameof(id));
            Name                 = name;
            IsDeleted            = isDeleted;
            Comment              = comment;
            IsTemporary          = isTemporary;
            PricePerQuantity     = pricePerQuantity;
            QuantityType         = quantityType ?? throw new System.ArgumentNullException(nameof(quantityType));
            QuantityInPacket     = quantityInPacket;
            QuantityTypeInPacket = quantityTypeInPacket ?? throw new System.ArgumentNullException(nameof(quantityTypeInPacket));
            ItemCategory         = itemCategory;
            Manufacturer         = manufacturer;
            IsInBasket           = isInBasket;
            Quantity             = quantity;
        }
        public StoreItemReadModel(ItemId id, string name, bool isDeleted, string comment, bool isTemporary,
                                  QuantityTypeReadModel quantityType, float quantityInPacket, QuantityTypeInPacketReadModel quantityTypeInPacket,
                                  ItemCategoryReadModel itemCategory, ManufacturerReadModel manufacturer,
                                  IEnumerable <StoreItemAvailabilityReadModel> availabilities)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new System.ArgumentException($"'{nameof(name)}' cannot be null or empty", nameof(name));
            }

            Id                   = id ?? throw new System.ArgumentNullException(nameof(id));
            Name                 = name;
            IsDeleted            = isDeleted;
            Comment              = comment;
            IsTemporary          = isTemporary;
            QuantityType         = quantityType ?? throw new System.ArgumentNullException(nameof(quantityType));
            QuantityInPacket     = quantityInPacket;
            QuantityTypeInPacket = quantityTypeInPacket ?? throw new System.ArgumentNullException(nameof(quantityTypeInPacket));
            ItemCategory         = itemCategory;
            Manufacturer         = manufacturer;
            this.availabilities  = availabilities ?? throw new System.ArgumentNullException(nameof(availabilities));
        }