def remove(self, todoNum): index = self.is_exist(todoNum) if index >= 0: TodoService.schedules.pop(index) return "{0}를 삭제하였습니다.".format(todoNum) else: try: raise IDNotFoundException(todoNum) except IDNotFoundException as removeError: return str(removeError)
def remove(self, id): index = self.is_exist(id) if index > -1: StudentService.students.pop(index) return f"{id}의 정보가 삭제하였습니다." else: try: raise IDNotFoundException(id) except IDNotFoundException as removeError: return str(removeError)
def update(self, id, price): index = self.is_exist(id) if index > -1: self.products[index].price = price return "{0}번 제품의 가격이 변경되었습니다.".format(id) else: try: IDNotFoundException(id) except IDNotFoundException as updateError: return str(updateError)
def remove(self, id) : index = self.is_exist(id) if index > -1 : StudentService.students.pop(index) return "{0} 정보를 삭제했습니다.".format(id) else : try: raise IDNotFoundException(id) except IDNotFoundException as removeError: return str(removeError)
def update(self, id, major): index = self.is_exist(id) if index > -1 : StudentService.students[index].major = major return "{0}의 전공 정보가 수정되었습니다.".format(id) else : try : raise IDNotFoundException(id) except IDNotFoundException as updateError: return str(updateError)
def update(self, id, major): index = self.is_exist(id) print(f"update index: {index}") if index > -1: StudentService.students[index].major = major return f"{id}의 전공정보가 수정되었습니다." else: try: raise IDNotFoundException(id) except IDNotFoundException as updateError: return str(updateError)
def remove(self, id): # is_exist()를 이용해야 함. index = self.is_exist(id) if index > -1: self.products.pop(index) # 역시나 pop(index) return "{0}번 제품이 삭제되었습니다.".format(id) else: # try: raise , except Exception: return str() try: raise IDNotFoundException(id) # error가 생성자에 의해 생성됨. except IDNotFoundException as removeError: return str( removeError) # 그 생성된 객체를 str로 형변환하여 (return)호출하여 보여줌.