//GET: /Authentication/
 public ActionResult Index()
 {
     try
     {
         if (User.Identity.IsAuthenticated)
         {
             AuthenticationContext db = new AuthenticationContext(new Authentication
             {
                 Username = User.Identity.Name,
                 Type = Session["role"].ToString()
             });
             return RedirectToAction("Index", db.LandingPage);
         }
         return View();
     }
     catch
     {
         FormsAuthentication.SignOut();
         return View();
     }
 }
 public ActionResult Index(Authentication login)
 {
     try
     {
         UpdateModel(login);
         AuthenticationContext db = new AuthenticationContext(login);
         if (db.Message == "")
         {
             FormsAuthentication.SetAuthCookie(login.Username, false);
             Session["role"] = login.Type;
             base.dbAudit._userid = dbAdmin.GetIdForUser(login.Username);
             base.dbAudit.LoggedIn();
             return RedirectToAction("Index", db.LandingPage);
         }
         ViewBag.ErrorMessage = db.Message;
         return View();
     }
     catch (Exception ex)
     {
         ViewBag.ErrorMessage = ex.Message;
         return View();
     }
 }