代码背后的剑道通知

时间:2017-11-14 12:09:31

标签: kendo-ui notifications code-behind

我搜索过,但没有找到解决问题的方法。我的问题是我无法从我的控制器调用通知,所有通知代码都与razor或js或html内部有关。我必须从.cs文件和我的cs文件这样写;

  [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> Login(Kullanici model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            if (string.IsNullOrEmpty(model.KullaniciAdi))
            {
                // 
            }

            KullaniciDAL kullanicidal = new KullaniciDAL();
            Kullanici kullanici = kullanicidal.GetRowByKullaniciAdi(model.KullaniciAdi);

            if (string.IsNullOrEmpty(kullanici.KullaniciAdi))
            {
                // 
            }

            string s = Code.Dev.Crypto.Decrypt(kullanici.Sifre);
            if (s == model.Sifre)
            {
                HttpCookie cookie = new HttpCookie("CustId", kullanici.CustId);
                cookie.Expires = DateTime.Now.AddDays(2);
                HttpContext.Response.Cookies.Add(cookie);

                cookie = new HttpCookie("KullaniciAdi", kullanici.KullaniciAdi);
                cookie.Expires = DateTime.Now.AddDays(2);
                HttpContext.Response.Cookies.Add(cookie);

                cookie = new HttpCookie("KullaniciRol", "Uzman");
                cookie.Expires = DateTime.Now.AddDays(2);
                HttpContext.Response.Cookies.Add(cookie);
                return RedirectToLocal(returnUrl);
            }
            else
            {
                //notification will be showed
                //Kendo.Mvc.UI.NotificationTemplate notification = new Kendo.Mvc.UI.NotificationTemplate();
                //notification
                return View("Login");
            }
        }

0 个答案:

没有答案