public async Task <int> PromeniLozinku(Korisnik korisnik, string novaLozinka) { using (var context = new StudentskaSluzbaDBContext()) { var entity = await context.Korisnik.FirstOrDefaultAsync(k => k.Username == korisnik.Username); entity.Password = Enkripcija.Enkriptuj(novaLozinka); return(await context.SaveChangesAsync()); } }
private async void PromeniLozinku() { if (App.TrenutniKorisnik.Password != Enkripcija.Enkriptuj(StaraLozinka)) { await new MessageDialog("Stara lozinka nije tacna!").ShowAsync(); } else if (NovaLozinka1 != NovaLozinka2) { await new MessageDialog("Nove lozinke se ne poklapaju!").ShowAsync(); } else { await new EFCoreDataProvider().PromeniLozinku(App.TrenutniKorisnik, NovaLozinka1); await new MessageDialog("Uspesno promenjena lozinka").ShowAsync(); GoBack(); } }
public async Task AddReferentAsync(Referent referent) { using (var context = new StudentskaSluzbaDBContext()) { // Prvo dodajem novog korsnika Korisnik k = new Korisnik { Username = referent.UsernameReferenta, Password = Enkripcija.Enkriptuj("1234"), Usertype = "referent" }; await context.Korisnik.AddAsync(k); await context.Referent.AddAsync(referent); await context.SaveChangesAsync(); } }
public async Task <Korisnik> LoginIspravan(string username, string password) { using (var context = new StudentskaSluzbaDBContext()) { var rez = await context.Korisnik.FirstOrDefaultAsync(k => k.Username == username && k.Password == Enkripcija.Enkriptuj(password)); return(rez); } }