Owneat Technical Guide main Help

Class Category

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

[Table("Categories")] public sealed class Category : Entity, IAuditable, ISortableElement

Inheritance

object ← Entity ← Category

Implements

IAuditable, ISortableElement

Inherited Members

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

Category\(\)

public Category()

Properties

Formulas

public IEnumerable<Formula> Formulas { get; }

Property Value

IEnumerable < Formula \>

IsFormulaSpecific

public bool IsFormulaSpecific { get; init; }

Property Value

bool

[ForeignKey("MenuId")] public Guid MenuId { get; set; }

Property Value

Guid

Name

[Required] [MaxLength(50)] public string Name { get; set; }

Property Value

string

Period

public ServingPeriod Period { get; init; }

Property Value

ServingPeriod

Products

public IEnumerable<Product> Products { get; }

Property Value

IEnumerable < Product \>

RestaurantId

public Guid RestaurantId { get; init; }

Property Value

Guid

SortingIndex

Position of the inherit element in it's parent.

public int SortingIndex { get; set; }

Property Value

int

Methods

Clone\(\)

Create and return a clone of the Restaurant.Domain.Aggregates.CategoryAggregate.Category object which call that method. This method clone the values and not the ID, it is made to clone a menu to edit it after. This method uses a builder pattern giving responsibility to each Common.Primitives.Entity to clone itself.

public Category Clone()

Returns

Category

The cloned Restaurant.Domain.Aggregates.CategoryAggregate.Category

Create\(string, Guid, ServingPeriod, bool\)

public static Category Create(string name, Guid restaurantId, ServingPeriod period, bool isFormulaSpecific)

Parameters

name string

restaurantId Guid

period ServingPeriod

isFormulaSpecific bool

Returns

Category

GetAllFormulas\(\)

public IEnumerable<Formula> GetAllFormulas()

Returns

IEnumerable < Formula \>

GetAllProducts\(\)

public IEnumerable<Product> GetAllProducts()

Returns

IEnumerable < Product \>

InsertNewFormula\(Formula\)

public void InsertNewFormula(Formula formula)

Parameters

formula Formula

InsertNewProduct\(string, string, string, double, VatRate, Guid\)

public Product InsertNewProduct(string name, string description, string displayImageUrl, double price, VatRate vatRate, Guid restaurantGuid)

Parameters

name string

description string

displayImageUrl string

price double

vatRate VatRate

restaurantGuid Guid

Returns

Product

RemoveFormula\(Formula\)

Remove a Restaurant.Domain.Aggregates.FormulaAggregate.Formula from a Restaurant.Domain.Aggregates.CategoryAggregate.Category.

public void RemoveFormula(Formula formula)

Parameters

formula Formula

RemoveProduct\(Product\)

Remove a Restaurant.Domain.Aggregates.ProductAggregate.Product from a Restaurant.Domain.Aggregates.CategoryAggregate.Category.

public void RemoveProduct(Product product)

Parameters

product Product

Rename\(string\)

public void Rename(string newName)

Parameters

newName string

UpdateSortingIndex\(int\)

Update the position of the Restaurant.Domain.Aggregates.CategoryAggregate.Category in its Menu.

public void UpdateSortingIndex(int newSortingIndex)

Parameters

newSortingIndex int

New position.

Last modified: 21 May 2024