public void PurchaseProducts(NewPurchaseDto dto) { // check if user can purchase these products // save products with decreased quantity // handle concurent purchasing // create event based on database data var @event = new ProductsPurchased(); mediator.Publish(@event); }
public HttpStatusCode PurchasedProduct(NewPurchaseDto dto) { // if app service handled purchasing return OK // otherwise return bad request try { _productsService.PurchaseProducts(dto); return(HttpStatusCode.OK); } catch (Exception) { return(HttpStatusCode.BadRequest); } }