public async Task <ActionResult <TodoItemSqlServer> > PostTodoItemSqlServer(TodoItemSqlServer todoItemSqlServer) { _context.TodoItemSqlServer.Add(todoItemSqlServer); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTodoItemSqlServer", new { id = todoItemSqlServer.Id }, todoItemSqlServer)); }
public async Task <IActionResult> PutTodoItemSqlServer(long id, TodoItemSqlServer todoItemSqlServer) { if (id != todoItemSqlServer.Id) { return(BadRequest()); } _context.Entry(todoItemSqlServer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TodoItemSqlServerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TodoItemSqlServer> > PostTodoItemSqlServer(TodoItemSqlServer todoItemSqlServer) { if (todoItemSqlServer == null) { return(BadRequest()); } await _repository.Add(todoItemSqlServer).ConfigureAwait(false); return(CreatedAtAction("GetTodoItemSqlServer", new { id = todoItemSqlServer.Id }, todoItemSqlServer)); }
public async Task <IActionResult> PutTodoItemSqlServer(long id, TodoItemSqlServer todoItemSqlServer) { if (todoItemSqlServer != null && id != todoItemSqlServer.Id) { return(BadRequest()); } try { await _repository.Update(todoItemSqlServer).ConfigureAwait(false); } catch (DbUpdateConcurrencyException) { throw; } return(NoContent()); }