public IActionResult PosodobiProfil(Uporabnik u, string geslo_ponovi) { if (TempData["ID_uporabnika"] == null) { return(RedirectToAction("Login", "Home")); } DALUporabnik dpp = new DALUporabnik(configuration); int ID_uporabnikaa = Convert.ToInt32(TempData["ID_uporabnika"]); Uporabnik uu = dpp.dobiPodatke(ID_uporabnikaa); DALDrzava dz = new DALDrzava(configuration); List <Drzava> d = dz.vrniVseDrzave(); ViewBag.Drzava = d; ViewBag.Message = uu; if (u.Geslo != null || geslo_ponovi != null) { if (u.Geslo != geslo_ponovi) { ViewBag.Error = "Gesli se ne ujemata"; return(View("Profil")); } var regex = @"^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$"; var match = Regex.Match(u.Geslo, regex, RegexOptions.IgnoreCase); if (!match.Success) { ViewBag.Error = "Geslo mora vsebovati minimalno 8 znakov in 1 številka"; return(View("Profil")); } } int ID_uporabnika = Convert.ToInt32(TempData["ID_uporabnika"]); TempData.Keep(); DALUporabnik dp = new DALUporabnik(configuration); // todo error če je failov request int ratal = Convert.ToInt32(dp.posodobiUporabnika(ID_uporabnika, u)); ViewBag.Success = "Podatki uspešno posodobljeni"; return(View("Profil")); }
public IActionResult Profil() { if (TempData["ID_uporabnika"] == null) { return(RedirectToAction("Login", "Home")); } int ID_uporabnika = Convert.ToInt32(TempData["ID_uporabnika"]); TempData.Keep(); DALUporabnik dp = new DALUporabnik(configuration); Uporabnik u = dp.dobiPodatke(ID_uporabnika); DALDrzava dz = new DALDrzava(configuration); List <Drzava> d = dz.vrniVseDrzave(); ViewBag.Drzava = d; ViewBag.Message = u; return(View()); }