public async Task <IActionResult> PutTodoItem(int id, TodoItem todoItem) { if (id != todoItem.Id) { return(BadRequest()); } _context.Entry(todoItem).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TodoItemExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutClient(int id, Client client) { if (id != client.ID) { return(BadRequest()); } _context.Entry(client).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutUser([FromRoute] int id, [FromBody] User user) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } 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 IActionResult PutTodoItem(int id, Tarea item) { if (id != item.Id) { return(BadRequest()); } _context.Entry(item).State = EntityState.Modified; _context.SaveChanges(); return(NoContent()); }
public async Task <IActionResult> PutTodoItem(long id, TodoItem item) { if (id != item.Id) { return(BadRequest()); } _context.Entry(item).State = EntityState.Modified; await _context.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult> PutEditProjectClient(int clientID, int projectID) { var project = await _context.Projects.FindAsync(projectID); if (project == null) { return(NotFound()); } project.ClientID = clientID; _context.Entry(project).State = EntityState.Modified; await _context.SaveChangesAsync(); return(Ok()); }
public bool Update(TEntity obj) { _db.Entry(obj).State = EntityState.Modified; return(_db.SaveChanges() > 0); }