asp.net core mvc razor page call pagemodel actio

45

asp.net core mvc razor page call pagemodel actio -

// Backend:
public IActionResult OnGetSellProduct(int id)
{
    var products = _context.Products;

    _context.Products.Find(id).SubtractProduct();
    return Page();
}

<!-- FrontEnd: -->
<a asp-page-handler="SellProduct" asp-route-id="@item.ProductId">Sell Product</a>

Comments

Submit
0 Comments