示例#1
0
        public FubuContinuation post_create(Create todo)
        {
            var todoToCreate = new Domain.Todo(todo.Name, todo.IsComplete);

            _toDoService.Create(todoToCreate);

            return(FubuContinuation.RedirectTo <TodoEndpoint>(endpoint => endpoint.get_list()));
        }
示例#2
0
        public Task <Domain.Todo> AddAsync(string title)
        {
            var todo = new Domain.Todo
            {
                Id          = Guid.NewGuid(),
                IsCompleted = false,
                Title       = title
            };

            _todos.TryAdd(todo.Id, todo);
            return(Task.FromResult(todo));
        }
        public async Task Foo()
        {
            /* Setup */
            var readModleComponent = new ListLogicalComponent(
                _webhostComponent.GetService <IMessageSubscriber>(),
                _webhostComponent.GetService <IMessagePublisher>()
                );

            await Task.Delay(TimeSpan.FromSeconds(10));

            await readModleComponent.StartAsync();

            var todo = new Domain.Todo
            {
                Id          = Guid.NewGuid(),
                IsCompleted = false,
                Title       = "Run test"
            };

            await _webhostComponent.PublishAsync(new TodoCreated(todo));

            await Task.Delay(TimeSpan.FromHours(1));
        }
示例#4
0
 public Task AddOrUpdateAsync(Domain.Todo todo)
 {
     _todos.AddOrUpdate(todo.Id, id => todo, (id, existing) => todo);
     return(Task.CompletedTask);
 }
示例#5
0
文件: Update.cs 项目: tdawgy/FubuTodo
 public Update(Domain.Todo todo)
 {
     Id         = todo.Id;
     Name       = todo.Name;
     IsComplete = todo.IsComplete;
 }