コード例 #1
0
ファイル: controller.py プロジェクト: nojongmun/python_tensor
class Controller:
    def __init__(self):
        self.service = Service()

    def register(self, name, phone, email, addr):
        entity = Entity()
        entity.name = name
        entity.phone = phone
        entity.email = email
        entity.addr = addr

        self.service.add_contact(entity)

    def list(self):
        return self.service.get_contacts()

    def remove(self, name):
        return self.service.del_contacts(name)
コード例 #2
0
class Controller:
    def __init__(self):
        self._service = Service()

    def register(self, name, phone, email, addr):
        model = Model()
        model.name = name
        model.phone = phone
        model.email = email
        model.addr = addr
        self._service.add_contact(model)

    def search(self, name) -> object:
        return self._service.get_contact(name)

    def list(self):
        return self._service.get_contacts()

    def remove(self, name):
        return self._service.del_contact(name)