public async Task <ActionResult <Produto> > DeleteProduto([FromBody] Produto produto)
        {
            try
            {
                _context.Remove(produto);
                await _context.SaveChangesAsync();

                return(Json(await _context.Produtos.OrderByDescending(p => p.Id).ToListAsync()));;
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
示例#2
0
 public void Remove(TEntity entity)
 {
     QuickBuyContext.Remove(entity);
     QuickBuyContext.SaveChanges();
 }
示例#3
0
 public void Remover(T entity)
 {
     _quickBuyContext.Remove(entity);
     _quickBuyContext.SaveChanges();
 }