//Assincrono public async Task Update(Vendas.WebApp.Models.Venda venda) { bool hasAny = await context.Venda.AnyAsync(x => x.Id == venda.Id); if (!hasAny) { throw new NotFoundException("Id not found"); } try { context.Update(venda); await context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException e) { throw new DbConcurrencyException(e.Message); } }
//Assincrono - InsertAsync(Venda Venda) public async Task InsertAsync(Vendas.WebApp.Models.Venda venda) { context.Add(venda); await context.SaveChangesAsync(); }