Esempio n. 1
0
        public async Task <IActionResult> Post([FromBody] TaskForCreationDto taskForCreation)
        {
            var task = new Domain.Entities.Task();
            // Map the Dto columnForCreation to column. For example refer BoardController
            // Assign the AssigneeIds of task by providing the userIds if needed
            await _unitOfWork.Tasks.AddAsync(task);

            await _unitOfWork.SaveChangesAsync();

            return(Ok(task));
        }
Esempio n. 2
0
 public IActionResult Update([FromBody] Domain.Entities.Task task)
 {
     try
     {
         _taskService.UpdateTask(task);
         return(StatusCode(200));
     }
     catch (Exception)
     {
     }
     return(StatusCode(400));
 }
Esempio n. 3
0
        public async Task <IActionResult> Put([FromBody] TaskForUpdateDto taskForUpdate)
        {
            var id   = taskForUpdate.TaskId;
            var task = new Domain.Entities.Task()
            {
                // Map the Dto userForUpdate to user by assigning properties
                // Add other members by assigning userIds in the list AssigneeIds of task
            };
            await _unitOfWork.Tasks.UpdateAsync(id, task);

            await _unitOfWork.SaveChangesAsync();

            return(Ok());
        }
        private static void SeedProjects()
        {
            var subtask1 = new Subtask()
            {
                Name   = "p1s1t1 subtask1",
                IsDone = true
            };

            var subtask2 = new Subtask()
            {
                Name   = "p1s1t1 subtask2",
                IsDone = false
            };

            var task1 = new Task()
            {
                Name       = "p1s1 task1",
                Priority   = TaskPriority.High.ToString(),
                TaskStatus = TaskStatus.ToDo.ToString(),
                DueDate    = DateTime.UtcNow.AddDays(2),
                Subtasks   = new List <Subtask>()
                {
                    subtask1, subtask2
                },
                Assigns = new List <TaskAssignment>()
                {
                    new ()
                    {
                        isActive = true,
                        UserId   = User1.Id
                    }
                }
            };

            var task2 = new Task()
            {
                Name       = "p1s1 task2",
                Priority   = TaskPriority.High.ToString(),
                TaskStatus = TaskStatus.Done.ToString(),
                DueDate    = DateTime.UtcNow.AddDays(2),
                Subtasks   = new List <Subtask>()
                {
                    new()
                    {
                        Name   = "p1s1t2 subtask1",
                        IsDone = true
                    },
                    new()
                    {
                        Name   = "p1s1t2 subtask2",
                        IsDone = false
                    },
                }
            };

            var task3 = new Task()
            {
                Name       = "p1s1 task3",
                Priority   = TaskPriority.High.ToString(),
                TaskStatus = TaskStatus.Done.ToString(),
                DueDate    = DateTime.UtcNow.AddDays(2),
            };

            var step1 = new Step()
            {
                Name  = "p1 step1",
                Tasks = new List <Task>()
                {
                    task1,
                    task2,
                    task3,
                    new()
                    {
                        Name       = "p1s1 task4",
                        Priority   = TaskPriority.High.ToString(),
                        TaskStatus = TaskStatus.InProgress.ToString(),
                        DueDate    = DateTime.UtcNow.AddDays(2),
                    }
                }
            };

            var project1 = new Project()
            {
                Name     = "project1",
                DueDate  = DateTime.UtcNow.AddDays(14),
                IsActive = true,
                Assigns  = new List <ProjectAssignment>()
                {
                    new()
                    {
                        MemberType  = ProjectMemberType.Manager.ToString(),
                        ProjectRole = ProjectRole.SuperMember.ToString(),
                        UserId      = User1.Id,
                    },
                    new()
                    {
                        MemberType  = ProjectMemberType.Manager.ToString(),
                        ProjectRole = ProjectRole.Member.ToString(),
                        UserId      = User3.Id
                    }
                },