public async Task <IActionResult> Post([FromBody] CarrinhoCliente input) { if (!ModelState.IsValid) { return(BadRequest(input)); } try { var carrinho = await _repository.UpdateCarrinhoAsync(input); return(Ok(carrinho)); } catch (KeyNotFoundException) { return(NotFound()); } }
public async Task <IActionResult> Post([FromBody] CarrinhoCliente input) { if (!ModelState.IsValid) { return(BadRequest(input)); } try { var carrinho = await _repository.UpdateCarrinhoAsync(input); await this._connection .InvokeAsync("UpdateUserBasketCount", $"{input.ClienteId}", carrinho.Itens.Count); return(Ok(carrinho)); } catch (KeyNotFoundException) { return(NotFound()); } }