public ActionResult Register(User account)
 {
     //if the modelstate is valid
     if (ModelState.IsValid)
     {
         using (SiteContext db = new SiteContext())
         {
             //add a user
             db.Users.Add(account);
             //save the details entered
             db.SaveChanges();
         }
         ModelState.Clear();
         //display success message
         ViewBag.Message = account.FirstName + "" + account.LastName + " successfully registered.";
     }
     return View();
 }
 public ActionResult Login(User user)
 {
     using (SiteContext db = new SiteContext())
     {
         // lambda expression to compare that compares the variable on the website to the one stored in the database
         var usr = db.Users.Single(u => u.Email == user.Email && u.Password == user.Password);
         //if the 'user' var is not null..
         if (usr != null)
         {
             //convert to string and transfer data to session variable
             Session["UserID"] = usr.UserID.ToString();
             Session["Email"] = usr.Email.ToString();
             //Transfer page to 'LoggedIn' page
             return RedirectToAction("LoggedIn");
         }
         //if there is a probelm
         else
         {
             //display error msg
             ModelState.AddModelError("", "Email or Password is incorrect.");
         }
     }
     return View();
 }