// GET: Account
 public ActionResult Index()
 {
     using (NikkiAutoserviceContext db = new NikkiAutoserviceContext())
     {
         return(View(db.userAccount.ToList()));
     }
 }
 public ActionResult Register(UserAccount account)
 {
     if (ModelState.IsValid)
     {
         using (NikkiAutoserviceContext db = new NikkiAutoserviceContext())
         {
             db.userAccount.Add(account);
             db.SaveChanges();
         }
         ModelState.Clear();
         ViewBag.Message = account.FirstName + " " + account.LastName + " successfully registered";
     }
     return(View());
 }
 public ActionResult Login(UserAccount user)
 {
     using (NikkiAutoserviceContext db = new NikkiAutoserviceContext())
     {
         var usr = db.userAccount.FirstOrDefault(u => u.Username == user.Username && u.Password == user.Password);
         if (usr != null)
         {
             Session["UserID"]   = usr.UserID.ToString();
             Session["Username"] = usr.Username.ToString();
             Session["Fullname"] = (usr.FirstName + " " + usr.LastName).ToString();
             //return RedirectToAction("LoggedId");
             return(RedirectToAction("Index", "Home"));
         }
         else
         {
             ModelState.AddModelError("", "Username or Password is wrong!");
         }
     }
     return(View());
 }