This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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