Пример #1
0
        public async Task <Task> CreateTaskCompletion(Guid assignToUserId, Guid taskId)
        {
            Task task = _dbContext.Tasks.Find(taskId);

            task.DateTimeCompleted = DateTime.Now;

            await _dbContext.SaveChangesAsync();

            return(await GetUsersTaskCompletionByUserAndTaskId(assignToUserId, taskId));
        }
Пример #2
0
        public async Task <Task> CreateTaskAssignmen(Guid assignToUserId, Guid taskId)
        {
            Task task = _dbContext.Tasks.Find(taskId);

            task.AssignedToUserId = assignToUserId;
            task.DateTimeAssigned = DateTime.Now;

            await _dbContext.SaveChangesAsync();

            return(await GetUsersTaskAssignmentByUserAndTaskId(assignToUserId, taskId));
        }
Пример #3
0
        public async Task <bool> DeleteTaskCompletion(Guid taskId)
        {
            Task task = _dbContext.Tasks.Find(taskId);

            if (task == null)
            {
                return(false);
            }

            task.DateTimeCompleted = null;

            await _dbContext.SaveChangesAsync();

            return(true);
        }
Пример #4
0
        public async Task <bool> DeleteTask(Guid taskId)
        {
            Task task = await _dbContext.Tasks.FindAsync(taskId);

            if (task == null)
            {
                return(false);
            }

            _dbContext.Tasks.Remove(task);

            await _dbContext.SaveChangesAsync();

            return(true);
        }
Пример #5
0
        public async Task <bool> DeleteTaskAssignment(Guid taskId)
        {
            Task task = _dbContext.Tasks.Find(taskId);

            if (task == null)
            {
                return(false);
            }

            task.AssignedToUserId = null;
            task.DateTimeAssigned = null;

            await _dbContext.SaveChangesAsync();

            return(true);
        }
Пример #6
0
        public async Task <Task> UpdateGroupTask(Guid taskId, string title, string description, DateTime deadline)
        {
            Task task = await _dbContext.Tasks.FindAsync(taskId);

            if (task == null)
            {
                return(null);
            }

            task.Title       = title;
            task.Description = description;
            task.Deadline    = deadline;

            await _dbContext.SaveChangesAsync();

            return(task);
        }
Пример #7
0
        public async Task <Task> CreateGroupTask(Guid groupId, string title, string description, DateTime deadline, Guid createdByUserId)
        {
            var task = new Task
            {
                Id              = Guid.NewGuid(),
                GroupId         = groupId,
                Title           = title,
                Description     = description,
                Deadline        = deadline,
                CreatedByUserId = createdByUserId
            };

            _dbContext.Tasks.Add(task);
            await _dbContext.SaveChangesAsync();

            return(await GetTaskByTaskId(task.Id));
        }