public async Task <IActionResult> PutUsers(int id, Users users) { if (id != users.Id) { return(BadRequest()); } _context.Entry(users).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UsersExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
//AƱade el token al usuario en la bbdd private async Task <bool> AnadirTokenAsync(string token) { persistUser.Token = token; _context.Entry(persistUser).State = EntityState.Modified; try { var result = await _context.SaveChangesAsync(); return(result > 0); } catch (DbUpdateConcurrencyException) { return(false); } }