public ActionResult Edit(User user)
 {
     try {
         _userRepository.Update(user);
         return Redirect("~/Device/Success");
     }
     catch (Exception ex) { ModelState.AddModelError("", ex.Message); }
     return View();
 }
 public bool Authenticate(User user)
 {
     return (user.Username == "root" && user.Password == "12345");
 }
 public bool Authenticate(User user)
 {
     return userRepository.Authenticate(user.Username, user.Password) != null;
 }
 public ActionResult Add(User user)
 {
     try { _userRepository.Add(user); }
     catch (Exception ex) { ModelState.AddModelError("", ex.Message); }
     return RedirectToAction("List");
 }