コード例 #1
0
        public ActionResult Index(GirisModel model)
        {
            using (ServisNoktasi servis = new ServisNoktasi())
            {
                if(ModelState.IsValid)
                {
                    Yonetici yonetici = new Yonetici();
                    yonetici.KullaniciAdi = model.KullaniciAdi;
                    yonetici.Sifre = model.Sifre;
                    IslemSonucu sonuc = servis.Yonetici.GirisYap(yonetici);
                    if (!sonuc.BasariliMi)
                    {
                        ModelState.AddModelError("HataliGiris", sonuc.Mesaj);
                        return View();
                    }
                    string userInfo = String.Format("admin;{0};{1}",yonetici.Id,yonetici.KullaniciAdi);
                    FormsAuthentication.SetAuthCookie(userInfo, true);

                    var routeValues = TempData["yonlendirmeDegerleri"];
                    if(routeValues!=null)
                    {
                        RouteValueDictionary values = (RouteValueDictionary)routeValues;
                        string action = values["action"].ToString();
                        string controller = values["controller"].ToString();
                        return RedirectToAction(action,controller,values);
                    }
                    return RedirectToAction("Index", "YoneticiAnasayfa");
                }
                return View();
            }
        }
コード例 #2
0
 public BaseController()
 {
     Servis = new ServisNoktasi();
 }
コード例 #3
0
 public LayoutController()
 {
     Servis = new ServisNoktasi();
 }