public ActionResult Settings() { if (Session["Login"] == null) { return(RedirectToAction("Login", "Panel")); } DB.Settings set = db.Settings.FirstOrDefault(x => x.ID == 1); Models.SettingsModels models = new Models.SettingsModels(); models.Settings = set; return(View(models)); }
public ActionResult Login(Models.LoginModels login) { try { DB.Settings set = db.Settings.FirstOrDefault(x => x.ID == 1); if (login.UserName == set.username && login.Password == set.password) { Session["Login"] = true; return(RedirectToAction("Index", "Panel")); } else { throw new Exception(); } } catch (Exception ex) { TempData["LoginErr"] = ex.Message; return(RedirectToAction("Login", "Panel")); } }
public ActionResult Settings(Models.SettingsModels models) { if (Session["Login"] == null) { return(RedirectToAction("Login", "Panel")); } try { DB.Settings set = db.Settings.FirstOrDefault(x => x.ID == 1); set.ModifiedDate = DateTime.Now; set.tr_Title = models.Settings.tr_Title; set.en_Title = models.Settings.en_Title; set.username = models.Settings.username; set.password = models.Settings.password; db.SaveChanges(); TempData["SetSuc"] = "Ayarlar Kayıt Edildi"; return(RedirectToAction("Settings", "Panel")); } catch (Exception ex) { TempData["SetErr"] = ex.Message; return(View()); } }