Fix possible view exception in pos app

Replaced string.format with a simpler replace and also allow `{Price}` instead of `{0}` as it's obscure to non c# devs
This commit is contained in:
Kukks 2020-06-09 19:56:44 +02:00
parent 74b6aa7353
commit db7768ef57
2 changed files with 2 additions and 2 deletions

View file

@ -249,7 +249,7 @@
</div> </div>
<div class="card-footer pt-0 bg-transparent border-0"> <div class="card-footer pt-0 bg-transparent border-0">
<span class="text-muted small">@String.Format(Model.ButtonText, @item.Price.Formatted)</span> <span class="text-muted small">@Model.ButtonText.Replace("{0}",item.Price.Formatted).Replace("{Price}",item.Price.Formatted)</span>
@if (item.Inventory.HasValue) @if (item.Inventory.HasValue)
{ {

View file

@ -55,7 +55,7 @@
{ {
<form method="post" asp-controller="AppsPublic" asp-action="ViewPointOfSale" asp-route-appId="@Model.AppId" asp-antiforgery="false"> <form method="post" asp-controller="AppsPublic" asp-action="ViewPointOfSale" asp-route-appId="@Model.AppId" asp-antiforgery="false">
<button type="submit" name="choiceKey" class="js-add-cart btn btn-primary" value="@item.Id"> <button type="submit" name="choiceKey" class="js-add-cart btn btn-primary" value="@item.Id">
@String.Format(Model.ButtonText, @item.Price.Formatted) @Model.ButtonText.Replace("{0}",item.Price.Formatted).Replace("{Price}",item.Price.Formatted)
</button> </button>
</form> </form>
} }