コード例 #1
0
        public ActionResult Guncelle(Kullanici model, string yeniSifre)
        {
            Kullanici kullanici = Session["loginSU"] as Kullanici;

            if (model.Sifre != kullanici.Sifre)
            {
                TempData["Message"] = new TempDataDictionary {
                    { "class", "alert alert-danger" }, { "msg", "Şifre Hatalı" }
                };
                return(RedirectToAction("Guncelle", new { id = model.KullaniciId }));
            }
            else
            {
                using (KullaniciRepository repo = new KullaniciRepository())
                {
                    bool result = repo.Create(model);
                    TempData["Message"] = result == true ? new TempDataDictionary {
                        { "class", "alert alert-success" }, { "msg", "İşletme Güncellendi" }
                    } : new TempDataDictionary {
                        { "class", "alert alert-danger" }, { "msg", "İşletme Güncellenemedi" }
                    };
                    return(RedirectToAction("Liste"));
                }
            }
        }
コード例 #2
0
 public ActionResult Ekle(Kullanici model)
 {
     using (KullaniciRepository repo = new KullaniciRepository())
     {
         model.Sifre = Guid.NewGuid().ToString();
         bool result = repo.Create(model);
         TempData["Message"] = result == true ? new TempDataDictionary {
             { "class", "alert alert-success" }, { "msg", "İşletme eklendi." }
         } : new TempDataDictionary {
             { "class", "alert alert-danger" }, { "msg", "İşletme eklenemedi." }
         };
         return(RedirectToAction("Liste"));
     }
 }