コード例 #1
0
        public CreateResultDo CreateTaskDo(TaskDo taskDo)
        {
            var       dependantTask = taskDo.DependantTaskId.HasValue ? this.tasksRepository.Find(taskDo.DependantTaskId.Value) : null;
            TaskModel task          = new TaskModel(
                this.userContext,
                taskDo.InternalImportance,
                taskDo.ExternalImportance,
                taskDo.Clearness,
                taskDo.Closeness,
                taskDo.Simplicity,
                taskDo.Title,
                taskDo.Description,
                taskDo.Tag,
                taskDo.Thumbnail,
                taskDo.DeadlineDate,
                taskDo.DeadlineTime,
                taskDo.Duration,
                taskDo.StateId,
                taskDo.ActionId,
                taskDo.DependantTaskId,
                dependantTask != null ? dependantTask.State : null,
                taskDo.CreateAppointment,
                taskDo.IsRecurringGroup,
                taskDo.RecurringGroupIntervalInDays,
                taskDo.RecurringGroupStartDate);

            this.tasksRepository.Add(task);

            this.unitOfWork.Save();

            return(new CreateResultDo()
            {
                Id = task.TaskId
            });
        }
コード例 #2
0
        public void UpdateTask(int id, TaskDo taskDo)
        {
            var task = this.tasksRepository.Find(id);

            if (task.UserId != this.userContext.UserId)
            {
                throw new Exception("You do not have permissions on this task");
            }

            var dependantTask = taskDo.DependantTaskId.HasValue ? this.tasksRepository.Find(taskDo.DependantTaskId.Value) : null;

            task.Modify(
                taskDo.InternalImportance,
                taskDo.ExternalImportance,
                taskDo.Clearness,
                taskDo.Closeness,
                taskDo.Simplicity,
                taskDo.Title,
                taskDo.Description,
                taskDo.Tag,
                taskDo.Thumbnail,
                taskDo.DeadlineDate,
                taskDo.DeadlineTime,
                taskDo.Duration,
                taskDo.StateId,
                taskDo.ActionId,
                taskDo.DependantTaskId,
                dependantTask != null ? dependantTask.State : null,
                taskDo.CreateAppointment,
                taskDo.IsRecurringGroup,
                taskDo.RecurringGroupIntervalInDays,
                taskDo.RecurringGroupStartDate);

            this.unitOfWork.Save();
        }