def post_get(self, cursor_object):
        if len(cursor_object.get_data()) > 0:
            branch_model: BranchModel = BranchModel()
            for each_tuple in cursor_object.get_data():
                branch_model.branchid = each_tuple[0]
                branch_model.name = each_tuple[1]
                branch_model.code = each_tuple[2]

            return branch_model
        else:
            return None
Пример #2
0
    def delete(self, request: HttpRequest):
        branch_json = json.loads(request.POST.get("branch_json"))

        branch_object: BranchModel = BranchModel()
        branch_object.branchid = branch_json.get("branchid")
        branch_object.name = branch_json.get("name")
        branch_object.code = branch_json.get("code")

        branch_service: BranchService = BranchService()
        branch_object = branch_service.delete(branch_object)

        return self.send_response(branch_object)
    def post_get_list(self, cursor_object):
        list_data = []
        if len(cursor_object.get_data()) > 0:
            for each_tuple in cursor_object.get_data():
                branch_model: BranchModel = BranchModel()
                branch_model.branchid = each_tuple[0]
                branch_model.name = each_tuple[1]
                branch_model.code = each_tuple[2]

                list_data.append(branch_model)

            return list_data
        else:
            return None