Created
July 22, 2020 23:16
-
-
Save dcomartin/8bf800a915b934fe64858d44e823810b to your computer and use it in GitHub Desktop.
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