Example #1
0
        public async Task <bool> InsertParentTask(ParentTask TaskItem)
        {
            bool status;

            try
            {
                _DbContext.ParentTask.Add(TaskItem);
                await _DbContext.SaveChangesAsync();

                status = true;
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Example #2
0
        public async Task <bool> InsertTask(Tasks TaskItem, ParentTask parentTask)
        {
            bool status;

            try
            {
                TaskItem.Status = true;
                _DbContext.Tasks.Add(TaskItem);
                _DbContext.ParentTask.Add(parentTask);

                await _DbContext.SaveChangesAsync();

                status = true;
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Example #3
0
        public async Task <bool> UpdateTask(Tasks item, ParentTask parentItem)
        {
            bool status;

            try
            {
                Tasks taskItem = _DbContext.Tasks.Where(p => p.Task_ID == item.Task_ID && p.Status == true).FirstOrDefault();



                if (taskItem != null)
                {
                    ParentTask parenttaskItem = _DbContext.ParentTask.Where(p => p.Parent_Task == taskItem.Task).FirstOrDefault();

                    taskItem.Task       = item.Task;
                    taskItem.Start_Date = null;
                    taskItem.End_Date   = null;
                    taskItem.Priority   = null;
                    taskItem.User_ID    = null;
                    //taskItem.Project_ID = item.Project_ID;
                    taskItem.Parent_ID = null;
                    if (parenttaskItem != null)
                    {
                        parenttaskItem.Parent_Task = item.Task;
                    }

                    await _DbContext.SaveChangesAsync();
                }
                status = true;
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }