Ejemplo n.º 1
0
        public async Task <bool> CompleteMemberTask(TaskVm model)
        {
            isOperationSuccessful = false;

            var result = await CompleteMemTask(model.ToCompleteMemberTaskCommand());

            Console.WriteLine(JsonSerializer.Serialize(result));

            if (result != null)
            {
                var updatedTasks = (await GetAllTasks()).Payload;

                if (updatedTasks != null)
                {
                    isOperationSuccessful = true;
                    tasksToDo             = updatedTasks;
                    TasksChanged?.Invoke(this, null);
                    return(isOperationSuccessful);
                }

                UpdateTaskFailed?.Invoke(this, "The save was successful, but we can no longer get an updated list of tasks from the server.");
                return(isOperationSuccessful);
            }

            UpdateTaskFailed?.Invoke(this, "Unable to save changes.");
            return(isOperationSuccessful);
        }
Ejemplo n.º 2
0
        public async Task <bool> AssignTask(TaskVm model)
        {
            isOperationSuccessful = false;

            var result = await Assign(model.ToAssignTaskCommand());

            if (result != null)
            {
                var updatedTasks = (await GetAllTasks()).Payload;

                if (updatedTasks != null)
                {
                    isOperationSuccessful = true;
                    tasksToDo             = updatedTasks;
                    TasksChanged?.Invoke(this, null);
                    return(isOperationSuccessful);
                }

                UpdateTaskFailed?.Invoke(this, "The task assignment was successful, but we can no longer get an updated list of member wise tasks from the server.");
                return(isOperationSuccessful);
            }

            UpdateTaskFailed?.Invoke(this, "Unable to assign task(s).");
            return(isOperationSuccessful);
        }
Ejemplo n.º 3
0
        public async Task <bool> CreateTask(TaskVm model)
        {
            isOperationSuccessful = false;

            var result = await Create(model.ToCreateTaskCommand());

            if (result != null)
            {
                var updatedTasks = (await GetAllTasks()).Payload;

                if (updatedTasks != null)
                {
                    isOperationSuccessful = true;
                    tasksToDo             = updatedTasks;
                    TasksChanged?.Invoke(this, null);
                    return(isOperationSuccessful);
                }

                UpdateTaskFailed?.Invoke(this, "The creation was successful, but we can no longer get an updated list of tasks from the server.");
                return(isOperationSuccessful);
            }

            UpdateTaskFailed?.Invoke(this, "Unable to create record.");
            return(isOperationSuccessful);
        }
        public async Task ToggleTask(Guid id)
        {
            foreach (var taskModel in Tasks)
            {
                if (taskModel.Id == id)
                {
                    taskModel.IsDone = !taskModel.IsDone;

                    var result = await Update(taskModel.ToUpdateTaskCommand());

                    Console.WriteLine(JsonSerializer.Serialize(result));

                    if (result != null)
                    {
                        var updatedList = (await GetAllTasks()).Payload;

                        if (updatedList != null)
                        {
                            tasks = updatedList;
                            TasksUpdated?.Invoke(this, null);
                            return;
                        }
                        UpdateTaskFailed?.Invoke(this, "The save was successful, but we can no longer get an updated list of members from the server.");
                    }

                    UpdateTaskFailed?.Invoke(this, "Unable to save changes.");
                }
            }
        }
        public async Task AddTask(TaskModel model)
        {
            ListTasks.Add(model);
            TasksUpdated?.Invoke(this, null);

            var newModel = new TaskVm();

            newModel.Id           = model.Id;
            newModel.AssignedToId = model.Member;
            newModel.IsComplete   = model.IsDone;
            newModel.Subject      = model.Text;

            var result = await Create(newModel.ToCreateTaskCommand());

            if (result != null)
            {
                var updatedList = (await GetAllTasks()).Payload;

                if (updatedList != null)
                {
                    tasks = updatedList;
                    TasksChanged?.Invoke(this, null);
                    return;
                }
                UpdateTaskFailed?.Invoke(this, "The creation was successful, but we can no longer get an updated list of members from the server.");
            }

            UpdateTaskFailed?.Invoke(this, "Unable to create record.");
        }
        public async Task AddTask(TaskVm model)
        {
            var result = await Create(model.ToCreateTaskCommand());

            if (result != null)
            {
                var updatedList = (await GetAllTasks()).Payload;

                if (updatedList != null)
                {
                    _tasks = updatedList;
                    TasksUpdated?.Invoke(this, null);
                    return;
                }
                UpdateTaskFailed?.Invoke(this, "The creation was successful, but we can no longer get an updated list of tasks from the server.");
            }
            UpdateTaskFailed?.Invoke(this, "Unable to create record.");
        }
Ejemplo n.º 7
0
        public async Task UpdateTask(TaskVm model)
        {
            var result = await Update(model.ToUpdateTaskCommand());

            Console.WriteLine(JsonSerializer.Serialize(result));

            if (result != null)
            {
                var updatedTaskList = (await GetAllTasks()).Payload;

                if (updatedTaskList != null)
                {
                    _tasks = updatedTaskList;
                    TasksUpdated?.Invoke(this, null);
                    return;
                }
                UpdateTaskFailed?.Invoke(this, "The save was successful, but we can no longer get an updated list of tasks from the server.");
            }
            UpdateTaskFailed?.Invoke(this, "Unable to save changes.");
        }
        public async Task UpdateTask(TaskVm model)
        {
            var result = await Update(model.ToUpdateTaskCommand());

            Console.WriteLine(JsonSerializer.Serialize(result));

            if (result != null)
            {
                var updatedList = (await GetAllTasks()).Payload;

                if (updatedList != null)
                {
                    tasks = updatedList;
                    TasksChanged?.Invoke(this, null);
                    return;
                }
                UpdateTaskFailed?.Invoke(this, "The save was successful.");
            }
            UpdateTaskFailed?.Invoke(this, "Unable to save changes.");
        }
Ejemplo n.º 9
0
        public async Task ToggleTask(Guid id)
        {
            foreach (var taskModel in Tasks)
            {
                if (taskModel.Id == id)
                {
                    taskModel.IsComplete = !taskModel.IsComplete;

                    var result = await Update(taskModel.ToUpdateTaskCommand());

                    Console.WriteLine(JsonSerializer.Serialize(result));

                    if (result != null)
                    {
                        TasksUpdated?.Invoke(this, null);
                        return;
                    }
                    UpdateTaskFailed?.Invoke(this, "Unable to save changes.");
                }
            }
        }
        public async Task ToggleTask(Guid id)
        {
            var model = tasks.FirstOrDefault(t => t.Id == id);

            model.IsComplete = !model.IsComplete;
            var result = await Update(model.ToUpdateTaskCommand());

            if (result != null)
            {
                var updatedList = (await GetAllTasks()).Payload;

                if (updatedList != null)
                {
                    tasks = updatedList;
                    TasksUpdated?.Invoke(this, null);
                    return;
                }
                UpdateTaskFailed?.Invoke(this, "The creation was successful, but we can no longer get an updated list of members from the server.");
            }

            UpdateTaskFailed?.Invoke(this, "Unable to create record.");
        }
Ejemplo n.º 11
0
        public async Task AssignMemberToTask(Guid memberId)
        {
            SelectedTask.AssignedMemberId = memberId;

            var result = await Update(SelectedTask.ToUpdateTaskCommand());

            Console.WriteLine(JsonSerializer.Serialize(result));

            if (result != null)
            {
                var updatedList = (await GetAllTasks()).Payload;

                if (updatedList != null)
                {
                    Tasks = updatedList;
                    TasksUpdated?.Invoke(this, null);
                    return;
                }
                UpdateTasksFailed?.Invoke(this, "The save was successful, but we can no longer get an updated list of members from the server.");
            }
            UpdateTaskFailed?.Invoke(this, "Unable to save changes.");
        }
Ejemplo n.º 12
0
        private async Task UpdateTaskModel(TaskModel taskModel)
        {
            var taskVm = taskModel.ConvertToTaskVm();
            var result = await Update(taskVm.ToUpdateTaskCommand());

            if (result != null)
            {
                var updatedList = (await GetAllTasks()).Payload;

                if (updatedList != null)
                {
                    taskVms = updatedList;
                    TasksUpdated?.Invoke(this, null);
                    return;
                }
                UpdateTaskFailed?.Invoke(this, "The save was successful, but we can no longer get an updated list of members from the server.");

                return;
            }

            UpdateTaskFailed?.Invoke(this, "Unable to save changes.");
        }