public ActionResult Login() { Admin admin = _adminDal.GetAdmin("adminibo"); if (admin == null) { //I produce salt var salt = Guid.NewGuid().ToString(); //I create sample admin Admin sampleAdmin = new Admin() { UserName = "******", Name = "ibrahim", Surname = "bavlı", Mail = "*****@*****.**", Salt = salt, Password = "******", IsAccountActive = true }; //I'm encrypting the admin's password. sampleAdmin.Password = CryptoPass(sampleAdmin.UserName, sampleAdmin.Password, salt); _adminDal.CreateAdmin(sampleAdmin); } Session["login"] = null; return(View()); }
public ActionResult Index() { Admin admin = _adminDal.GetAdmin("admin"); if (admin == null) { Admin sampleAdmin = new Admin() { UserName = "******", Name = "ibrahim", Surname = "bavlı" }; _adminDal.CreateAdmin(sampleAdmin); } Admin _admin = _adminDal.GetAdmin("admin"); return(View(_admin)); }