def create(section): name = section.get("name", None) id_recipe = section.get("id_recipe", None) section = Section(None, name, id_recipe) id_section = SectionDAOimpl.insert(section) json.dumps(id_section) return id_section
def add_section(id_recipe, section): section_to_insert = Section(None, section.get("name", None), id_recipe) id_section = SectionDAOimpl.insert(section_to_insert) for ingredient in section.get("ingredients", None): SectionDAOimpl.addIngredientToDB(id_section, ingredient.get("id_ingredient", None), ingredient.get("quantity", None), ingredient.get("unit", None)) for instruction in section.get("instructions", None): InstructionDAOimpl.insert(Instruction(None, instruction.get("text", None), id_section))