예제 #1
0
        public async Task <Task> Add(Task task)
        {
            var taskTracker = await _context.Tasks.AddAsync(task);

            await _context.SaveChangesAsync();

            var taskToReturn = await Watch(task.Id, task.CreatorId);

            if (taskTracker.Entity.CreatorId != taskTracker.Entity.AssigneeId)
            {
                taskToReturn = await Watch(task.Id, task.AssigneeId);
            }
            return(taskToReturn);
        }
예제 #2
0
        public async Task <IActionResult> Create(TaskForCreationDto task)
        {
            if (!await _users.UserExist(task.CreatorId) || !await _users.UserExist(task.AssigneeId) || !await _organizations.OrganizationExist(task.OrganizationId))
            {
                return(BadRequest("Bad request data, data don't exist."));
            }
            var taskToCreate = new Task
            {
                Title          = task.Title,
                Description    = task.Description,
                CreatorId      = task.CreatorId,
                AssigneeId     = task.AssigneeId,
                OrganizationId = task.OrganizationId,
                Created        = DateTime.Now,
                LastUpdated    = DateTime.Now,
            };
            var taskCreated = await _repo.Add(taskToCreate);

            var taskToReturn = _mapper.Map <TaskForListDto>(taskCreated);

            return(Ok(taskToReturn));
        }
예제 #3
0
 public Task <Task> Unwatch(Task task, User user)
 {
     throw new System.NotImplementedException();
 }
예제 #4
0
 public Task <Task> Unassign(Task task)
 {
     throw new System.NotImplementedException();
 }
예제 #5
0
 public Task <Task> Modify(Task task)
 {
     throw new System.NotImplementedException();
 }
예제 #6
0
 public Task <Task> Delete(Task task)
 {
     throw new System.NotImplementedException();
 }