Ejemplo n.º 1
0
        public async void DeleteTask(ChecklistDetail taskInfo)
        {
            var result = await _toDoService.DeleteToDoInfoByIdAsync(taskInfo.Id);

            if (result)
            {
                SingleChecklist.ChecklistDetails.Remove(taskInfo);
            }
        }
Ejemplo n.º 2
0
        public async void DeleteTask(ChecklistDetail t)
        {
            var r = await toDoService.DeleteToDoInfoByIdAsync(t.Id);

            if (r)
            {
                SingleChecklist.ChecklistDetails.Remove(t);
            }
        }
Ejemplo n.º 3
0
        public async Task <bool> AddToDoDetailAsync(string id, ChecklistDetail detail)
        {
            var res = await App.Instance.Checklists.FirstOrDefaultAsync(t => t.Id == id);

            if (res != null)
            {
                detail.ChecklistId = res.Id;
                await App.Instance.ChecklistDetails.AddAsync(detail);

                return(await App.Instance.SaveChangesAsync() > 0);
            }
            return(false);
        }
Ejemplo n.º 4
0
        public async Task <bool> AddToDoDetailAsync(string id, ChecklistDetail detail)
        {
            try
            {
                var cl = App.Instance.Checklists.FirstOrDefault(t => t.Id == id);
                if (cl != null)
                {
                    detail.ChecklistId = cl.Id;
                    await App.Instance.ChecklistDetails.AddAsync(detail);

                    return(await App.Instance.SaveChangesAsync() > 0 ? true : false);
                }
                return(false);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        public async void AddTask()
        {
            if (string.IsNullOrWhiteSpace(Content))
            {
                return;
            }
            ChecklistDetail detail = new ChecklistDetail();

            detail.Id      = Guid.NewGuid().ToString();
            detail.Content = Content;
            var result = await _toDoService.AddToDoDetailAsync(SingleChecklist.Checklist.Id, detail);

            if (result)
            {
                SingleChecklist.ChecklistDetails.Add(new ChecklistDetail {
                    Content = Content
                });
                Content = string.Empty;
            }
        }
Ejemplo n.º 6
0
        public async void UpdateDeleteStatus(ChecklistDetail detail)
        {
            bool result = false;

            if (detail.IsDeleted)
            {
                result = false;
            }
            else
            {
                result = true;
            }

            var r = await toDoService.UpdateDeleteStatus(detail.Id, result);

            if (r)
            {
                detail.IsDeleted = result;
            }
        }
Ejemplo n.º 7
0
 public async void UpdateFavoriteStatus(ChecklistDetail detail)
 {
     await _toDoService.UpdateFavoriteStatus(detail.Id, !detail.IsFavorite);
 }
Ejemplo n.º 8
0
 public async void UpdateDeleteStatus(ChecklistDetail detail)
 {
     await _toDoService.UpdateDeleteStatus(detail.Id, !detail.IsDeleted);
 }