Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
@model DocumentModel
@{
//page title
ViewBag.Title = Loc["Admin.Documents.Document.Edit"];
//the record the document belongs to, as an entry of the overflow menu
(string Action, string Controller, string Resource, string Icon)? reference = null;
if (!string.IsNullOrEmpty(Model.ObjectId))
{
reference = (Reference)Model.ReferenceId switch {
Reference.Order => ("Edit", "Order", "Admin.Documents.Document.GoToOrder", "bi-cart"),
Reference.Shipment => ("ShipmentDetails", "Shipment", "Admin.Documents.Document.GoToShipment", "bi-box"),
Reference.MerchandiseReturn => ("Edit", "MerchandiseReturn", "Admin.Documents.Document.GoToMerchandiseReturn", "bi-box"),
Reference.Product => ("Edit", "Product", "Admin.Documents.Document.GoToProduct", "bi-box"),
Reference.Category => ("Edit", "Category", "Admin.Documents.Document.GoToCategory", "bi-box"),
Reference.Brand => ("Edit", "Brand", "Admin.Documents.Document.GoToBrand", "bi-box"),
Reference.Collection => ("Edit", "Collection", "Admin.Documents.Document.GoToCollection", "bi-box"),
Reference.Vendor => ("Edit", "Vendor", "Admin.Documents.Document.GoToVendor", "bi-box"),
_ => null
};
}
}
<form asp-area="@Constants.AreaAdmin" asp-controller="Document" asp-action="EditDocument" method="post" id="document-form">
@* the product edit screen's shell: the document's name as the title, Save as the one primary
action; the links to its customer and to the record it belongs to, and Delete, in the
overflow menu *@
<admin-page sticky
title="@Model.Name"
icon="bi-diagram-3"
meta="@Loc["Admin.Documents.Document.Edit"]"
back-url="@Url.Action("List")"
back-text="@Loc["Admin.Documents.Document.BackToList"]">
<page-actions>
<button class="btn btn-outline-secondary" type="submit" name="save-continue">
<i class="bi bi-check-circle"></i> @Loc["Admin.Common.SaveContinue"]
</button>
<button class="btn btn-primary" type="submit" name="save">
<i class="bi bi-check-lg"></i> @Loc["Admin.Common.Save"]
</button>
<admin-action-menu>
@if (!string.IsNullOrEmpty(Model.CustomerId))
{
<admin-action url="@Url.Action("Edit", "Customer", new { id = Model.CustomerId })"
icon="bi-person" text="@Loc["Admin.Documents.Document.GoToCustomer"]"/>
}
@if (reference is { } target)
{
<admin-action url="@Url.Action(target.Action, target.Controller, new { id = Model.ObjectId })"
icon="@target.Icon" text="@Loc[target.Resource]"/>
}
<admin-action id="document-delete" destructive="true" icon="bi-trash"
text="@Loc["Admin.Common.Delete"]"/>
</admin-action-menu>
<vc:admin-widget widget-zone="document_details_buttons" additional-data="Model"/>
</page-actions>
<partial name="Partials/CreateOrUpdateDocument" model="Model"/>
</admin-page>
</form>
<admin-delete-confirmation button-id="document-delete" action-name="DeleteDocument"/>