Ask: Basic Insert/Update to Database

Hi everyone, I’m new at the app development in owncloud. I follow the tutorial (https://docs.nextcloud.com/server/16/developer_manual/app/tutorial.html) to write my own nextcloud app.
I want to make a simple attendance system that input time and user note, and when clicked on submit, it’ll store to the database. But I still didn’t get the idea of insert or update to db. Can anyone help me? Thanks in advance.

Here is my code, when submit button clicked, it execute the checkin() :

<?php

OCP\User::checkLoggedIn();
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\App;
use OCA\Attendance\Service\NotFoundException;

date_default_timezone_set('Asia/Bangkok');
$current_date = date('d/m/Y H:i:s');
$uid = OCP\User::getUser();

class attend {
        private $controller;
        private $mapper;
        private $userId = 'devsam';

        public function checkin () {
        $app = new App('attendance');
        $container = $app->getContainer();

        $container->registerService('UserId', function($c) {
            return $this->userId;
        });

        $this->controller = $container->query('OCA\Attendance\Controller\NoteController');
        $this->mapper = $container->query('OCA\Attendance\Db\NoteMapper');

        $note = new Note();
        $note->setCondition('Okay');
        $note->setTimein('12/08/2020');
        $note->setUserId($this->userId);

        }
}

and the rest of it is my html form code.
The NoteMapper, NoteController etc contain the same code as the tutorial except the variables being changed into time and condition. When I try that, i got:

OCP\AppFramework\QueryException: Could not resolve service! Class service does not exist

Already solved, it’s because in the note service there were a misconception .