Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string postUporabnik(uporabnik uporabnik)
- {
- int stPrej = getVseUporabnike().Count();
- using (SqlConnection myConnection = new SqlConnection(con))
- {
- SqlCommand myCommand = new SqlCommand("INSERT INTO uporabnik(id,ime,priimek,geslo,uporabniskoIme,datumRojstva,eMail,ulica,postnaStevilka,imePoste) VALUES(@id,@ime,@priimek,@geslo,@uporabniskoIme,@datumRojstva,@eMail,@ulica,@postnaStevilka,@imePoste)", myConnection);
- myConnection.Open();
- List<uporabik> temp = getVseUporabnike();
- int id;
- if (temp.Count > 0)
- {
- id = temp.Last().ID + 1;
- }
- else
- {
- id = 1;
- }
- myCommand.Parameters.AddWithValue("@id", id);
- myCommand.Parameters.AddWithValue("@ime", uporabnik.ime);
- myCommand.Parameters.AddWithValue("@priimek", uporabnik.priimek);
- myCommand.Parameters.AddWithValue("@geslo", uporabnik.geslo);
- myCommand.Parameters.AddWithValue("@datumRojstva", uporabnik.datumRojstva);
- myCommand.Parameters.AddWithValue("@uporabniskoIme", uporabnik.uporabniskoIme);
- myCommand.Parameters.AddWithValue("@eMail", uporabnik.eMail);
- myCommand.Parameters.AddWithValue("@ulica", uporabnik.ulica);
- myCommand.Parameters.AddWithValue("@postnaStevilka", uporabnik.postnaStevilka);
- myCommand.Parameters.AddWithValue("@imePoste", uporabnik.imePoste);
- myCommand.ExecuteNonQuery();
- myConnection.Close();
- myCommand.Dispose();
- }
- if (stPrej < getZdravila().Count)
- {
- return "uspeh";
- }
- else return "neuspeh";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement