Пример #1
0
        public ServiceExecutionResultWithModel <Models.Todo> Find(int id)
        {
            if (!existTodoRepository.Exist(id))
            {
                return(ServiceExecutionResultWithModel <Models.Todo> .WitError());
            }

            var todo = findByTodoIdRepository.Find(id);

            return(ServiceExecutionResultWithModel <Models.Todo> .With(todo));
        }
Пример #2
0
        public ServiceExecutionResult Delete(int todoId)
        {
            if (!existTodoRepository.Exist(todoId))
            {
                return(ServiceExecutionResult.WithErrors(new List <Error> {
                    Error.With(nameof(todoId), ErrorCodes.NotFound)
                }));
            }

            deleteRepository.Delete(todoId);
            return(ServiceExecutionResult.WithSucess());
        }
Пример #3
0
 private bool IsNotExistTodo(int todoId)
 {
     return(!existTodoRepository.Exist(todoId));
 }