public async Task <IActionResult> Put([FromRoute] int id, [FromBody] Time time) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var _time = await _context.Times.FirstOrDefaultAsync(x => x.Id == id); if (_time != null) { if (time.Bandeira != null) { _time.Bandeira = time.Bandeira; } _time.NMTecnico = time.NMTecnico; _time.Pais = time.Pais; _context.Update(_time); await _context.SaveChangesAsync(); return(Ok(_time)); } else { return(NotFound()); } }