示例#1
0
 public ActionResult Create()
 {
     if (Session["LogedUserID"] != null)
     {
         try
         {
             var admin = db.SP_SelectAdmin();
             var roles = db.AspNetRoles.ToList();
             ViewBag.Roles = roles;
             return(View(admin));
         }
         catch (Exception ex)
         {
             ViewBag.successMessage = "";
             ViewBag.errorMessage   = "Error occurred while loading data.";
             return(View());
         }
     }
     else
     {
         //return RedirectToAction("AdminLogin", "Account");
         return(RedirectToAction("AdminLogin", "Account"));
     }
 }