f0f1f2.studio Template reference
English
Open application
Method

FormatFoodValueItem

Definition

Namespace
Resto.Front.PrintTemplates.Cheques.Razor

Formats a nutritional value with at most one decimal place.

string TemplateBase<T>.FormatFoodValueItem(decimal foodValueItem)
Returns
string
Nullability
Not specified
Declared in
Resto.Front.PrintTemplates.Cheques.Razor.TemplateBase<T>
Model purpose
Base class for Legacy Razor print templates. Model contains the document data of type T. Provides formatting and markup output methods.

Parameters

decimal foodValueItem
Nutritional value, already expressed in the required unit.

Return value

A number formatted with the 0.# pattern; a trailing fractional zero is omitted.

Remarks

Uses CurrentCulture. No unit is appended and no conversion between grams, kilocalories or other units is performed.

Example

// en-GB
FormatFoodValueItem(12.34m); // "12.3"
FormatFoodValueItem(12m); // "12"