37 lines
1.0 KiB
Plaintext
37 lines
1.0 KiB
Plaintext
@using Microsoft.AspNetCore.Http
|
|
@using Microsoft.AspNetCore.Http.Extensions;
|
|
|
|
@model Groceries.Data.Store
|
|
@{
|
|
ViewBag.Title = "Edit Store";
|
|
|
|
var returnUrl = Url.Action("Index", new { page = 1 });
|
|
if (Context.Request.GetTypedHeaders().Referer is Uri referer && referer.Host == Context.Request.Host.Host)
|
|
{
|
|
var requestUrl = new UriBuilder
|
|
{
|
|
Scheme = Context.Request.Scheme,
|
|
Host = Context.Request.Host.Host,
|
|
Port = Context.Request.Host.Port.GetValueOrDefault(-1),
|
|
Path = Context.Request.Path.ToString(),
|
|
Query = Context.Request.QueryString.ToString(),
|
|
}.Uri;
|
|
|
|
if (referer != requestUrl)
|
|
{
|
|
returnUrl = referer.PathAndQuery;
|
|
}
|
|
}
|
|
}
|
|
|
|
<h1>Edit Store</h1>
|
|
|
|
<form method="post" asp-action="EditStore">
|
|
<partial name="_StoreForm" />
|
|
|
|
<div class="row">
|
|
<button class="button button--primary" type="submit">Save</button>
|
|
<a class="button" href="@returnUrl">Cancel</a>
|
|
</div>
|
|
</form>
|