Skip to content

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.

Fix - remove picture on vendor info

KrzysztofPajak4cd7afb798a1
diff --git a/src/Web/Grand.Web/Controllers/VendorController.cs b/src/Web/Grand.Web/Controllers/VendorController.cs
index 677f70bf7..d1cc39ce2 100644
--- a/src/Web/Grand.Web/Controllers/VendorController.cs
+++ b/src/Web/Grand.Web/Controllers/VendorController.cs
@@ -351,8 +351,7 @@ namespace Grand.Web.Controllers
return View(model);
}
- [HttpPost]
- [AutoValidateAntiforgeryToken]
+ [HttpGet]
public virtual async Task<IActionResult> RemovePicture()
{
if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))
diff --git a/src/Web/Grand.Web/Endpoints/EndpointProvider.cs b/src/Web/Grand.Web/Endpoints/EndpointProvider.cs
index b9f3af6dc..90e3258be 100644
--- a/src/Web/Grand.Web/Endpoints/EndpointProvider.cs
+++ b/src/Web/Grand.Web/Endpoints/EndpointProvider.cs
@@ -206,6 +206,11 @@ namespace Grand.Web.Endpoints
pattern + "vendor/contact/{vendorId}",
new { controller = "Vendor", action = "ContactVendor" });
+ //vendor remove picture
+ endpointRouteBuilder.MapControllerRoute("CustomerVendorRemovePicture",
+ pattern + "vendor/removepicture",
+ new { controller = "Vendor", action = "RemovePicture" });
+
}
private void RegisterCatalogRoute(IEndpointRouteBuilder endpointRouteBuilder, string pattern)
diff --git a/src/Web/Grand.Web/Views/Vendor/Info.cshtml b/src/Web/Grand.Web/Views/Vendor/Info.cshtml
index 7192392b0..88ab681f2 100644
--- a/src/Web/Grand.Web/Views/Vendor/Info.cshtml
+++ b/src/Web/Grand.Web/Views/Vendor/Info.cshtml
@@ -45,7 +45,7 @@
{
<div class="vendor-picture mt-3">
<img src="@(Model.PictureUrl)" alt="picture" style="width:100px; display:block" />
- <input type="submit" asp-action="RemovePicture" name="remove-picture" class="btn btn-danger remove-picture-button mt-3" value="@Loc["Account.VendorInfo.Picture.Remove"]" />
+ <a asp-route="CustomerVendorRemovePicture" name="remove-picture" class="btn btn-danger remove-picture-button mt-3">@Loc["Account.VendorInfo.Picture.Remove"]</a>
</div>
}
</div>