@RequestMapping(value = "/login", method = RequestMethod.POST)
  // public ModelAndView login(@RequestParam("username")String
  // name,@RequestParam("password")String password)throws Exception{
  public ModelAndView login(@ModelAttribute User user) throws Exception {
    // service.login(name,password);
    // System.out.println(name+password);
    ModelAndView model = new ModelAndView();
    User user1 = service.login(user);

    if (user1.getUser_role() == 1) {
      String msg = "userlogin";
      model.setViewName("userdashboard");
      model.addObject("msg", msg);
    } else if (user1.getUser_role() == 2) {
      model.setViewName("admindashboard");
      String msg = "adminlogin";
      model.addObject("msg", msg);
    } else if (user1.getUser_role() == 3) {
      String msg = null;
      model.addObject("msg", msg);
      model.setViewName("home");
    } else {
      String msg = "error username or password error";
      model.addObject("msg", msg);
      model.setViewName("home");
    }
    return model;
  }
  @RequestMapping(value = "/registration", method = RequestMethod.POST)
  public ModelAndView value(@ModelAttribute User user) throws IOException {

    service.register(user);

    String msg = "register sucessfully";

    return new ModelAndView("home", "msg", msg);
  }
  @RequestMapping(value = "/movietime", method = RequestMethod.POST)
  public ModelAndView movietiming(@ModelAttribute Timings time) throws IOException {
    System.out.println(time.getTimings_id());
    service.movieTiming(time);

    String msg = "movie time register sucessfully";

    // return new ModelAndView("admindashboard","msg",msg);
    return new ModelAndView("redirect:/timelist", "msg", msg);
  }
  // movie updating
  @RequestMapping(value = "/movies", method = RequestMethod.POST)
  public ModelAndView movies(@ModelAttribute Admin admin) throws IOException {
    System.out.println("movuie");

    service.movieregister(admin);
    System.out.println(admin.getMovie_name());
    String msg = "movie register sucessfully";

    // return new ModelAndView("admindashboard","msg",msg);
    return new ModelAndView("redirect:/movielist", "msg", msg);
  }
  @RequestMapping(value = "/timelist")
  public ModelAndView timeList() throws IOException {

    List<Timings> times = service.timelist();

    System.out.println(times);
    ModelAndView model = new ModelAndView();

    model.addObject("TimeLists", times);
    model.setViewName("timinglist");
    return model;
  }
  // movie list
  @RequestMapping(value = "/movielist")
  public ModelAndView listusers() throws IOException {

    List<Admin> movies = service.movielist();

    System.out.println(movies);
    ModelAndView model = new ModelAndView();

    model.addObject("MovieList", movies);
    model.setViewName("movielist");
    return model;
  }