public virtual void AddSelfLink(Task task)
 {
     if (task.TaskId != null)
         task.AddLink(GetSelfLink(task.TaskId.Value));
 }
Пример #2
0
 public virtual void AddDeleteUserLink(Task task)
 {
     var pathFragment = string.Format("tasks/{0}/users/userId", task.TaskId.Value);
     var link = _commonLinkService.GetLink(pathFragment, "deleteUser", HttpMethod.Delete);
     task.AddLink(link);
 }
Пример #3
0
 public virtual void AddReplaceUsersLink(Task task)
 {
     var pathFragment = string.Format("tasks/{0}/users", task.TaskId.Value);
     var link = _commonLinkService.GetLink(pathFragment, "replaceUsers", HttpMethod.Put);
     task.AddLink(link);
 }
Пример #4
0
 public virtual void AddCreateNewTaskLink(Task task)
 {
     const string pathFragment = "tasks";
     var link = _commonLinkService.GetLink(pathFragment, "createTask", HttpMethod.Post);
     task.AddLink(link);
 }
Пример #5
0
 public virtual void AddAllTasksLink(Task task)
 {
     task.AddLink(GetAllTasksLink());
 }
Пример #6
0
 public virtual void AddAllStatusesLink(Task task)
 {
     task.AddLink(_statusLinkService.GetAllStatusesLink());
 }
Пример #7
0
        public virtual void AddWorkflowLink(Task task)
        {
            const int notStarted = 1;
            const int inProgress = 2;
            const int completed = 3;

            string pathFragment;
            string relValue;

            switch (task.Status.StatusId)
            {
                case notStarted:
                    pathFragment = string.Format("tasks/{0}/activations", task.TaskId.Value);
                    relValue = "activateTask";
                    break;
                case inProgress:
                    pathFragment = string.Format("tasks/{0}/completions", task.TaskId.Value);
                    relValue = "completeTask";
                    break;
                case completed:
                    pathFragment = string.Format("tasks/{0}/reactivations", task.TaskId.Value);
                    relValue = "re-activateTask";
                    break;
                default:
                    throw new InvalidOperationException("Invalid status: " + task.Status.StatusId);
            }

            var link = _commonLinkService.GetLink(pathFragment, relValue, HttpMethod.Put);
            task.AddLink(link);
        }
Пример #8
0
 public virtual void AddUpdateTaskLink(Task task)
 {
     var pathFragment = string.Format("tasks/{0}", task.TaskId.Value);
     var link = _commonLinkService.GetLink(pathFragment, "updateTask", HttpMethod.Put);
     task.AddLink(link);
 }