コード例 #1
0
 public static TheLoaiSachUI convertToUI(TheLoaiSach theLoaiSach) {
   TheLoaiSachUI tLUI = new TheLoaiSachUI();
   if (theLoaiSach != null) {
     tLUI.setMaTheLoai(theLoaiSach.getTenTheLoai());
     tLUI.setTenTheLoai(theLoaiSach.getTenTheLoai());
   }
   return tLUI;
 }
コード例 #2
0
 @RequestMapping(value = "/sach/add", method = RequestMethod.GET)
 public String hienThiThemSach(Model model) {
   List<TheLoaiSach> theLoaiSachs = theLoaiSachService.timDanhMucTheLoaiSach();
   List<TheLoaiSachUI> theLoaiSachUIs = new ArrayList<TheLoaiSachUI>();
   if (theLoaiSachs.size() > 0) {
     for (TheLoaiSach theLoaiSach : theLoaiSachs) {
       TheLoaiSachUI tLSachUIL = new TheLoaiSachUI();
       tLSachUIL.setMaTheLoai(theLoaiSach.getMaTheLoai());
       tLSachUIL.setTenTheLoai(theLoaiSach.getTenTheLoai());
       theLoaiSachUIs.add(tLSachUIL);
     }
   }
   SachUI sachUI = new SachUI();
   sachUI.setMaSach(UUID.randomUUID().toString());
   model.addAttribute("theLoaiUIs", theLoaiSachUIs);
   model.addAttribute("sachUI", sachUI);
   model.addAttribute("btnName", "Thêm Sách Mới");
   return WebConstant.views.THEM_SACH;
 }