Examples of YFDishCategory


Examples of com.supinfo.youfood.entity.YFDishCategory

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        boolean isOk = true;
        YFDishCategory dishCategory = new YFDishCategory();

        // Vérification des champs
        if (req.getParameter("id") != null && !req.getParameter("id").isEmpty()) {
            try {
                dishCategory = dishCategoryService.getDishCategoryById(Long.parseLong(req.getParameter("id")));
            } catch (Exception e) {
                req.setAttribute("idError", "Une erreur est survenue lors de la mise à jour de l'employé");
                isOk = false;
            }
        }

        if (req.getParameter("name") == null || req.getParameter("name").isEmpty()) {
            req.setAttribute("nameError", "Ne doit pas être vide.");
            isOk = false;
        } else {
            dishCategory.setName(req.getParameter("name"));
        }
       
        if (isOk) {
            if (dishCategory.getId() == null || dishCategory.getId() == 0) {
                dishCategoryService.createDishCategory(dishCategory);
            } else {
                dishCategoryService.updateDishCategory(dishCategory);
            }
            resp.sendRedirect(req.getContextPath() + "/administrator/dish/list");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.