Owneat Technical Guide main Help

Class Menu

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

[Table("Menus")] public sealed class Menu : Entity, IAggregateRoot, IAuditable, ISortableElement

Inheritance

object ← Entity ← Menu

Implements

IAggregateRoot, 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

public Menu()

Properties

Categories

This Restaurant.Domain.Aggregates.MenuAggregate.Menu.Categories field represents all the Restaurant.Domain.Aggregates.CategoryAggregate.Category contained in the menu.

public IEnumerable<Category> Categories { get; }

Property Value

IEnumerable < Category \>

Name

The name of the menu : i.e "Evening menu, afternoon menu".

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

Property Value

string

RestaurantId

Restaurant.Domain.Aggregates.MenuAggregate.Menu.RestaurantId of the restaurant that contains the Restaurant.Domain.Aggregates.MenuAggregate.Menu.

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

Property Value

Guid

SortingIndex

Position of the Restaurant.Domain.Aggregates.MenuAggregate.Menu in it's Restaurant.

[Required] public int SortingIndex { get; set; }

Property Value

int

States

This Restaurant.Domain.Aggregates.MenuAggregate.Menu.States field represents the actual state of the menu. By default a menu is drafted.

[Required] public MenuStates States { get; set; }

Property Value

MenuStates

Methods

Clone\(\)

Create and return a clone of the Restaurant.Domain.Aggregates.MenuAggregate.Menu 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 Menu Clone()

Returns

Menu

The cloned Restaurant.Domain.Aggregates.MenuAggregate.Menu

Create\(string\)

public static Menu Create(string name)

Parameters

name string

Returns

Menu

InsertCategory\(string, ServingPeriod, bool\)

Add a sub Restaurant.Domain.Aggregates.CategoryAggregate.Category on the Restaurant.Domain.Aggregates.MenuAggregate.Menu

public void InsertCategory(string name, ServingPeriod period, bool isFormulaSpecific)

Parameters

name string

period ServingPeriod

isFormulaSpecific bool

IsActive\(\)

Check if menu is active.

public bool IsActive()

Returns

bool

RemoveCategory\(Category\)

Remove a sub Restaurant.Domain.Aggregates.CategoryAggregate.Category from the Restaurant.Domain.Aggregates.MenuAggregate.Menu

public void RemoveCategory(Category category)

Parameters

category Category

SetState\(MenuStates\)

Set the Restaurant.Domain.Aggregates.MenuAggregate.Assets.MenuStates of the Restaurant.Domain.Aggregates.MenuAggregate.Menu

public void SetState(MenuStates states)

Parameters

states MenuStates

UpdateSortingIndex\(int\)

Update the position of the Restaurant.Domain.Aggregates.MenuAggregate.Menu in its Restaurant.

public void UpdateSortingIndex(int newSortingIndex)

Parameters

newSortingIndex int

New position.

Last modified: 21 May 2024