Owneat Technical Guide main Help

Class Product

Namespace: Restaurant.Domain.Aggregates.ProductAggregate
Assembly: Restaurant.Domain.dll

public sealed class Product : ProductBase, IAggregateRoot, IAuditable, ISortableElement

Inheritance

object ← Entity ← ProductBaseProduct

Implements

IAggregateRoot, IAuditable, ISortableElement

Inherited Members

ProductBase.Name, ProductBase.Description, ProductBase.DisplayImageUrl, ProductBase.UnitPrice, ProductBase.SortingIndex, ProductBase.IsAvailable, ProductBase.CategoryId, ProductBase.RestaurantId, ProductBase.ExternalPaymentId, ProductBase.Discriminator, ProductBase.UpdateBasicInfos\(string, string, string, double\), ProductBase.UpdateImageUrl\(string\), ProductBase.UpdateSortingIndex\(int\), ProductBase.UpdateExternalPaymentId\(string\), ProductBase.UpdateAvailability\(bool\), ProductBase.DeleteExternalPaymentId\(\), Entity.Id, Entity.CreatedAt, Entity.UpdatedAt, Entity.DomainEvents, object.Equals\(object?\), object.Equals\(object?, object?\), object.GetHashCode\(\), object.GetType\(\), object.ReferenceEquals\(object?, object?\), object.ToString\(\)

Constructors

Product\(\)

public Product()

Properties

Allergens

The list of Restaurant.Domain.Aggregates.ProductAggregate.Allergen contained in the Restaurant.Domain.Aggregates.ProductAggregate.Product.

public IEnumerable<Allergen> Allergens { get; }

Property Value

IEnumerable < Allergen \>

CategoryProductData

Shared data between Restaurant.Domain.Aggregates.ProductAggregate.Product and its Category.

public CategoryProductData CategoryProductData { get; init; }

Property Value

CategoryProductData

Discriminator

Discriminator that state the type of the inheritor.

[NotMapped] public override string Discriminator { get; }

Property Value

string

FoodLabels

The list of Restaurant.Domain.Aggregates.ProductAggregate.FoodLabel contained in the Restaurant.Domain.Aggregates.ProductAggregate.Product.

public IEnumerable<FoodLabel> FoodLabels { get; }

Property Value

IEnumerable < FoodLabel \>

FormulaSections

All Restaurant.Domain.Aggregates.ProductAggregate.Product.FormulaSectionss to which is linked the Restaurant.Domain.Aggregates.ProductAggregate.Product.

[InverseProperty("ContainedProducts")] [JsonIgnore] public List<FormulaSection> FormulaSections { get; init; }

Property Value

List < FormulaSection \>

Ingredients

The list of Restaurant.Domain.Aggregates.ProductAggregate.Ingredient contained in the Restaurant.Domain.Aggregates.ProductAggregate.Product.

public IEnumerable<Ingredient> Ingredients { get; }

Property Value

IEnumerable < Ingredient \>

IsOutOfStock

public bool IsOutOfStock { get; }

Property Value

bool

IsStockManagementEnabled

public bool IsStockManagementEnabled { get; }

Property Value

bool

Personalizations

The list of Restaurant.Domain.Aggregates.PersonalizationAggregate.Personalization contained in the Restaurant.Domain.Aggregates.ProductAggregate.Product.

public IEnumerable<Personalization> Personalizations { get; }

Property Value

IEnumerable < Personalization \>

Stock

Current available stock of the Restaurant.Domain.Aggregates.ProductAggregate.Product.

public uint? Stock { get; set; }

Property Value

uint?

VatRate

The VAT rate of the Restaurant.Domain.Aggregates.ProductAggregate.Product.

public VatRate VatRate { get; set; }

Property Value

VatRate

Methods

AddAllergen\(Allergen\)

public void AddAllergen(Allergen allergen)

Parameters

allergen Allergen

AddFoodLabel\(FoodLabel\)

public void AddFoodLabel(FoodLabel foodLabel)

Parameters

foodLabel FoodLabel

AddIngredient\(Ingredient\)

public void AddIngredient(Ingredient ingredient)

Parameters

ingredient Ingredient

AddPersonalization\(Personalization\)

public void AddPersonalization(Personalization personalization)

Parameters

personalization Personalization

Clone\(\)

public Product Clone()

Returns

Product

Create\(string, CategoryProductData, string, string, double, VatRate, Guid\)

public static Product Create(string name, CategoryProductData categoryProductData, string description, string displayImageUrl, double price, VatRate vatRate, Guid restaurantGuid)

Parameters

name string

categoryProductData CategoryProductData

description string

displayImageUrl string

price double

vatRate VatRate

restaurantGuid Guid

Returns

Product

DecrementStock\(uint\)

public bool DecrementStock(uint quantityToDecrement)

Parameters

quantityToDecrement uint

Returns

bool

HasExternalPaymentId\(\)

public bool HasExternalPaymentId()

Returns

bool

RemoveAllergen\(Allergen\)

public void RemoveAllergen(Allergen allergen)

Parameters

allergen Allergen

RemoveFoodLabel\(FoodLabel\)

public void RemoveFoodLabel(FoodLabel foodLabel)

Parameters

foodLabel FoodLabel

RemoveIngredient\(Ingredient\)

public void RemoveIngredient(Ingredient ingredient)

Parameters

ingredient Ingredient

UpdateCategoryName\(string\)

public void UpdateCategoryName(string newName)

Parameters

newName string

UpdateStock\(uint?\)

public void UpdateStock(uint? newStock)

Parameters

newStock uint?

UpdateVatRate\(VatRate\)

public void UpdateVatRate(VatRate vatRate)

Parameters

vatRate VatRate

Last modified: 21 May 2024