public int AddTaskwithParent(Tasks tasks) { ParentTask ptask = new ParentTask(); //if the task added is a parent task if (tasks.Task_Id != 0) { Tasks t = Task.Find(tasks.Task_Id); t.Parent_Id = tasks.Parent_Id; t.Task = tasks.Task; t.Priority = tasks.Priority; t.Start_Date = tasks.Start_Date; t.End_Date = tasks.End_Date; t.isEnded = false; } else { if (tasks.Parent_Id == -1) { ptask.Parent_Task = tasks.Task; Parenttask.Add(ptask); this.SaveChanges(); tasks.Parent_Id = ptask.Parent_Id; } Task.Add(tasks); } return(this.SaveChanges()); }
public int AddTaskwithParent(Tasks tasks) { ParentTask ptask = new ParentTask(); ptask.parent_task = tasks.task; Parenttask.Add(ptask); Task.Add(tasks); return(this.SaveChanges()); }
public int AddTaskwithParent(Tasks tasks, int isparent, Int64?user_id) { if (isparent == 1) { ParentTask ptask = new ParentTask(); ptask.parent_task = tasks.task; Parenttask.Add(ptask); } Task.Add(tasks); if (user_id != null && user_id != 0) { User u = users.Find(user_id); if (u != null) { u.project_id = tasks.project_id; u.task_id = tasks.task_id; } } return(this.SaveChanges()); }