Exemple #1
0
 public ActionResult Index(msanggotabem model, string returnUrl)
 {
     using (DBSIBEMEntities objContext = new DBSIBEMEntities())
     {
         var objUser = objContext.msanggotabems.FirstOrDefault(x => x.nim == model.nim && x.password == model.password);
         if (objUser == null)
         {
             ViewBag.Login = "******";
             return(View("Index"));
         }
         else
         {
             FormsAuthentication.SetAuthCookie(objUser.nama, true);
             string role      = objContext.msanggotabems.Where(m => m.nim == model.nim).FirstOrDefault().msjabatan.namajabatan;
             string idukmhima = objContext.msanggotabems.Where(m => m.nim == model.nim).FirstOrDefault().msjabatan.idukm_hima.ToString();
             string idDept    = objContext.msanggotabems.Where(m => m.nim == model.nim).FirstOrDefault().msdeparteman.iddepartemen.ToString();
             Session["idUKM_Hima"] = idukmhima;
             Session["idDept"]     = idDept;
             if (role.Equals("Admin"))
             {
                 return(RedirectToAction("MenuAdmin"));
             }
             else if (role.Contains("PIC"))
             {
                 return(RedirectToAction("MenuPIC"));
             }
             else if (role.Contains("Departemen"))
             {
                 return(RedirectToAction("MenuBPH"));
             }
             else
             {
                 return(RedirectToAction("MenuBPHUmum"));
             }
         }
     }
 }