Exemplo n.º 1
0
        /// <summary>
        /// Update current task
        /// </summary>
        /// <param name="model"></param>
        /// <returns>CompleteTaskCommandResult</returns>
        public async Task UpdateTask(TaskVM model)
        {
            try
            {
                var result = await Update(model.ToCompleteCommand());

                if (result != null)
                {
                    TaskCompleteSuccess.Invoke(this, null);
                }
                else
                {
                    TaskCompletedFailed.Invoke(this, null);
                }
            }
            catch (Exception ex)
            {
                TaskCompletedFailed.Invoke(this, null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Complete current task
        /// </summary>
        /// <param name="id"></param>
        /// <returns>CompleteTaskCommandResult</returns>
        public async Task ToggleTask(Guid id)
        {
            try
            {
                var isTaskCompleted = await CompleteTask(new CompleteTaskCommand()
                {
                    TaskId = id
                });

                if (isTaskCompleted != null)
                {
                    TaskCompleteSuccess.Invoke(this, null);
                }
                else
                {
                    TaskCompletedFailed.Invoke(this, null);
                }
            }
            catch (Exception ex)
            {
                TaskCompletedFailed.Invoke(this, null);
            }
        }