public async Task <IActionResult> PutClienteModel(ClienteModel ClienteModel)
        {
            try
            {
                var cliente = _context.Find <ClienteModel>(ClienteModel.Id);

                if (cliente == null)
                {
                    return(NotFound());
                }

                _context.Entry(cliente).State = EntityState.Detached;
                cliente = ClienteModel;
                _context.Update(cliente);
                await _context.SaveChangesAsync();

                return(NoContent());
            }
            catch (Exception ex)
            {
                var exception = ex;
                return(BadRequest());
            }
        }
示例#2
0
 public virtual TEntity Find(int id)
 {
     return(_dbcontext.Find <TEntity>(id));
 }