Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public Priority Get(long id)
        {
            var priority = _priorityFetcher.GetPriority(id);

            return(_priorityMapper.CreatePriority(priority));
        }
        public Priority Get(long taskId)
        {
            var task = _taskFetcher.GetTask(taskId);

            return(_priorityMapper.CreatePriority(task.Priority));
        }