示例#1
0
        public void EditTask(long taskId, string newTaskBody)
        {
            if (string.IsNullOrWhiteSpace(newTaskBody))
            {
                throw new ArgumentNullException(nameof(newTaskBody));
            }

            InquiryItem editingTask = tasks.SingleOrDefault(t => t.Id == taskId);

            if (editingTask == null)
            {
                throw new InvalidOperationException($"Task with Id = {taskId} is not found");
            }

            editingTask.Body = newTaskBody;
            ModifiedDate     = DateTime.Now;
        }
示例#2
0
        public void CompleteTask(long taskId)
        {
            InquiryItem completingTask = tasks.SingleOrDefault(t => t.Id == taskId);

            if (completingTask == null)
            {
                throw new InvalidOperationException($"Task with Id = {taskId} is not found");
            }

            completingTask.IsComleted = true;

            bool isAllTaskCompleted = tasks.All(t => t.IsComleted);

            if (!isAllTaskCompleted)
            {
                Status = InquiryStatus.Completed;
            }

            ModifiedDate = DateTime.Now;
        }