public TodoAggregateRoot Rebuild(Guid aggregateId) { var root = this.context.Set <TodoAggregateRoot>().FirstOrDefault(x => x.AggregateId == aggregateId); context.Attach(root); return(root); }
public async Task <IActionResult> OnPostUpdateAsync() { _db.Attach(TodoItem).State = EntityState.Modified; await _db.SaveChangesAsync(); return(RedirectToPage()); }
public async Task <TodoItem> AddAsync(Collection collection, TodoItem item) { _database.Attach(collection); collection.TodoItems.Add(item); await _database.SaveChangesAsync(); return(item); }
public async Task <int> RemoveItem(int id) { var item = new TodoItem { Id = id }; _context.Attach(item); _context.Remove(item); return(await _context.SaveChangesAsync()); }
public void UpdateTodo(Todo todo) { _context.Attach(todo); _context.Entry(todo).State = EntityState.Modified; _context.SaveChanges(); }