Beispiel #1
0
        public async Task <OperationResult <int> > AddCommentAsync(int taskId, string content)
        {
            var commentModel = new CommentModel(taskId, content);
            var commentId    = await _commentModelDbOperations.AddAsync(commentModel);

            return(OperationResult <int> .Ok(commentId));
        }
Beispiel #2
0
        public async Task <OperationResult <int> > AddTaskAsync(string name)
        {
            var taskModel        = new TaskModel(name);
            var validationResult = await _taskModelValidator.ValidateAsync(taskModel);

            if (!validationResult.IsValid)
            {
                return(ValidationHelper.GetValidationFailedOperationResult <int>(validationResult));
            }

            var taskId = await _taskModelDbOperations.AddAsync(taskModel);

            return(OperationResult <int> .Ok(taskId));
        }