public async Task <IActionResult> MoveLeft(int id) { var card = _context.Card.Find(id); Console.WriteLine(card.Id); if (card.ColumnId != 1) { card.ColumnId = (card.ColumnId - 1); _context.Entry(card).State = EntityState.Modified; } else { return(BadRequest()); } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CardExists(card.Id)) { return(NotFound()); } else { throw; } } return(Ok()); }
public async Task <IActionResult> PutCard(int id, Card card) { if (id != card.Id) { return(BadRequest()); } _context.Entry(card).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CardExists(id)) { return(NotFound()); } else { throw; } } return(Ok(card)); }
public async Task <IActionResult> PutUser(int id, User user) { if (id != user.Id) { return(BadRequest()); } _context.Entry(user).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public Usuario RegistrarAcesso(Usuario UsuarioAcesso) { UsuarioAcesso.UsuarioDtUltimoAcesso = DateTime.Now; Contexto.Usuario.Attach(UsuarioAcesso); Contexto.Entry(UsuarioAcesso).State = EntityState.Modified; Contexto.SaveChanges(); return(UsuarioAcesso); }