public async Task HandleAsync(ChangeToDoListStatusCommand command)
        {
            var status = (ToDoListStatus)command.Status;

            switch (status)
            {
            case ToDoListStatus.InProgress: await _toDoListsService.StartListAsync(command.ListId, command.UserId);

                break;

            case ToDoListStatus.Done: await _toDoListsService.CompleteListAsync(command.ListId, command.UserId);

                break;

            case ToDoListStatus.OnHold: await _toDoListsService.HoldListAsync(command.ListId, command.UserId);

                break;

            case ToDoListStatus.Cancelled: await _toDoListsService.CancelListAsync(command.ListId, command.UserId);

                break;

            case ToDoListStatus.Archived: await _toDoListsService.DeleteListAsync(command.ListId, command.UserId);

                break;

            default: throw new BusinessLogicException("incorrect_status");
            }
        }
示例#2
0
        public async Task RemoveListAsync(ToDoList list)
        {
            try
            {
                await _listsService.DeleteListAsync(list.Id)
                .ConfigureAwait(true);

                Lists.Remove(list);

                if (SelectedList?.Id == list.Id)
                {
                    SelectedList = null;
                    await SelectedListChanged.InvokeAsync(null)
                    .ConfigureAwait(true);
                }

                OnStateChanged();
            }
            catch (Exception ex)
            {
                await ShowErrorAsync(ex)
                .ConfigureAwait(true);
            }
        }