Пример #1
0
 public static Task AddTask(Task newTask)
 {
     int newId = Tasks.Max(t => t.TaskID) + 1;
     newTask.TaskID = newId;
     Tasks.Add(newTask);
     return newTask;
 }
Пример #2
0
 public void UpdateTask(int agentId, int taskId, Task updatedTask)
 {
     Agent agent = Database.Agents.SingleOrDefault(a => a.AgentID == agentId);
     Task task = agent.Tasks.Where(t => t.TaskID == taskId).SingleOrDefault();
     // Update the task from the database
     task.Description = updatedTask.Description;
     task.IsComplete = updatedTask.IsComplete;
 }
Пример #3
0
 public Task AddTask(int agentId, Task newTask)
 {
     Agent agent = Database.Agents.SingleOrDefault(a => a.AgentID == agentId);
     // Create the task and attach it to the agent entity
     newTask = Database.AddTask(newTask);
     agent.Tasks.Add(newTask);
     return newTask;
 }