Skip to content

Instantly share code, notes, and snippets.

@dcomartin dcomartin/page.cs

Created Jul 22, 2020
Embed
What would you like to do?
public async Task<IActionResult> OnPost(CatalogItemViewModel productDetails)
{
if (productDetails?.Id == null)
{
return RedirectToPage("/Index");
}
await SetBasketModelAsync();
var result = await _basketService.AddItemToBasket(BasketModel.Id, productDetails.Id, productDetails.Price, productDetails.Quantity);
await SetBasketModelAsync();
return result.Match<IActionResult>(
quantity => RedirectToPage(),
validationError => new BadRequestResult());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.