public void AddTask(CommonEntities.Tasks task) { Tasks tk = new Tasks { Task = task.Task, ProjectID = task.ProjectID, Priority = task.Priority, StartDate = task.StartDate, EndDate = task.EndDate, Status = false }; if (task.ParentTaskID == 0) { tk.ParentTaskID = null; } else { tk.ParentTaskID = task.ParentTaskID; } _projectManager.Tasks1.Add(tk); _projectManager.SaveChanges(); var taskId = tk.TaskID; var ur = _projectManager.Users1.Where(x => x.UserID == task.UserID).FirstOrDefault(); if (ur != null) { ur.TaskID = taskId; _projectManager.SaveChanges(); } }
public void UpdateTask(CommonEntities.Tasks task) { var tk = _projectManager.Tasks1.Where(x => x.TaskID == task.TaskID).FirstOrDefault(); if (tk != null) { tk.Task = task.Task; tk.ProjectID = task.ProjectID; tk.Priority = task.Priority; tk.StartDate = task.StartDate; tk.EndDate = task.EndDate; if (task.ParentTaskID == 0) { tk.ParentTaskID = null; } else { tk.ParentTaskID = task.ParentTaskID; } _projectManager.SaveChanges(); var ur = _projectManager.Users1.Where(x => x.UserID == task.UserID).FirstOrDefault(); if (ur != null) { ur.TaskID = tk.TaskID; _projectManager.SaveChanges(); } } }
public void EndTask(CommonEntities.Tasks task) { var tk = _projectManager.Tasks1.Where(x => x.TaskID == task.TaskID).FirstOrDefault(); if (tk != null) { tk.Status = true; _projectManager.SaveChanges(); } }