예제 #1
0
 @RequestMapping(
     value = {"/add"},
     method = RequestMethod.POST)
 @ResponseBody
 public EventModel add(HttpServletRequest request, @ModelAttribute EventModel em) {
   Event event = new Event();
   event.setUid(em.getUid());
   // 格式:"2015-07-02 8:0:0"
   event.setStart(DataUtil.StrToDate(em.getStart()));
   event.setEnd(DataUtil.StrToDate(em.getEnd()));
   int eventId = eventService.add(event);
   em.setId(eventId);
   return em;
 }
예제 #2
0
 @RequestMapping(
     value = {"/update"},
     method = RequestMethod.POST)
 @ResponseBody
 public boolean update(HttpServletRequest request, @ModelAttribute EventModel em) {
   try {
     Event event = new Event();
     event.setId(em.getId());
     event.setUid(em.getUid());
     // 格式:"2015-07-02 8:0:0"
     event.setStart(DataUtil.StrToDate(em.getStart()));
     event.setEnd(DataUtil.StrToDate(em.getEnd()));
     eventService.update(event);
     return true;
   } catch (Exception e) {
     e.printStackTrace();
   }
   return false;
 }