public Task CreateTask(Data.Model.Task modelTask)
        {
            var task = new Task
            {
                TaskId        = modelTask.TaskId,
                Subject       = modelTask.Subject,
                StartDate     = modelTask.StartDate,
                DateCompleted = modelTask.DateCompleted,
                DueDate       = modelTask.DueDate,
                CreatedDate   = modelTask.CreatedDate,
                Status        = _statusMapper.CreateStatus(modelTask.Status),
                Priority      = _priorityMapper.CreatePriority(modelTask.Priority),
                Categories    = modelTask
                                .Categories
                                .Select(_categoryMapper.CreateCategory)
                                .ToList(),
                Assignees = modelTask
                            .Users
                            .Select(_userMapper.CreateUser)
                            .ToList()
            };

            task.Links = new List <Link>
            {
                new Link
                {
                    Title = "self",
                    Rel   = "self",
                    Href  = "/api/tasks/" + task.TaskId
                },
                new Link
                {
                    Title = "Categories",
                    Rel   = "categories",
                    Href  = "/api/tasks/" + task.TaskId + "/categories"
                },
                new Link
                {
                    Title = "Assignees",
                    Rel   = "users",
                    Href  = "/api/tasks/" + task.TaskId + "/users"
                }
            };

            return(task);
        }
        public Status Get(long id)
        {
            var status = _statusFetcher.GetStatus(id);

            return(_statusMapper.CreateStatus(status));
        }
Beispiel #3
0
        public Status Get(long taskId)
        {
            var task = _taskFetcher.GetTask(taskId);

            return(_statusMapper.CreateStatus(task.Status));
        }