protected void Awake() { List <MethodInfo> methodsInfo = new List <MethodInfo> { GeneralTool.GetMethodInfo(this, "OnPull", flagsToSearch), GeneralTool.GetMethodInfo(this, "OnCallLinks", flagsToSearch), GeneralTool.GetMethodInfo(this, "OnRelease", flagsToSearch) }; for (int i = 0; i < methodsInfo.Count(); i++) { if (methodsInfo[i] != null) { actions.Add((Action)Delegate.CreateDelegate(typeof(Action), this, methodsInfo[i])); } else { actions.Add(null); } } if (links != null) { foreach (var action in links.actions) { action.Initialize(); } } }
public async Task <IActionResult> Login(Admin model, string ReturnUrl) { string password = GeneralTool.getMD5(model.Password); Admin admin = adminRepo.GetBy(g => g.EmailAddress == model.EmailAddress && g.Password == password) ?? null; if (admin != null) { ClaimsIdentity claimsIdentity = new ClaimsIdentity(new List <Claim> { new Claim(ClaimTypes.Email, admin.EmailAddress), new Claim(ClaimTypes.PrimarySid, admin.ID.ToString()), new Claim(ClaimTypes.Name, admin.Name + " " + admin.Surname) }, "TemplateCore"); ClaimsPrincipal claimsPrincipal = new ClaimsPrincipal(claimsIdentity); await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrincipal, new AuthenticationProperties() { IsPersistent = true }); if (!string.IsNullOrEmpty(ReturnUrl)) { return(Redirect(ReturnUrl)); } else { return(RedirectToAction("Index")); } } else { ViewBag.hata = "Geçersiz Kullanıcı Adı veya Şifre..."; return(View(model)); } }
public IActionResult Detay(string title, int id) { if (!string.IsNullOrEmpty(title)) { News selectedNews = news.FirstOrDefault(x => GeneralTool.UrlConvert(x.Title) == title && x.ID == id) ?? null; if (selectedNews == null) { return(Redirect("/")); } else { return(View(selectedNews)); } } else { return(Redirect("/")); } }