public ActionResult Index() { //GetCarouselImgs var db = new alpensternEntities(); var carouselImgs = new List <CarouselImgVM>(); foreach (var img in db.get_carousel_imgs.ToList()) { carouselImgs.Add(new CarouselImgVM(img.id, img.bilderart, img.pfad)); } var carouselImgListVM = new CarouselImgListVM(carouselImgs); return(View(carouselImgListVM)); }
public ActionResult Login(string benutzername, string passwort) { if (benutzername == "" || passwort == "") { SqlConnection conn = new SqlConnection(); SqlCommand comm = new SqlCommand("SELECT get_user_salt(" + benutzername + ");"); string salt = (string)comm.ExecuteScalar(); string hashedPasswort = Hasher.hash(passwort + salt); comm = new SqlCommand("SELECT login_user(" + benutzername + ", " + hashedPasswort + ");"); int?id = (int?)comm.ExecuteScalar(); if (id != null) { var db = new alpensternEntities(); Session["user"] = db.Login.Find(id); return(View()); } } return(RedirectToAction("Index", "Login feherhaft")); }