Esempio n. 1
0
 private void button3_Click(object sender, EventArgs e)
 {
     var bytt = true;
     if (mc.HavePassSetting())
     {
         if (!mc.GetPassord().Equals(textBox1.Text))
         {
             bytt = false;
         }
     }
     if (!bytt) return;
     if (!textBox2.Text.Equals(textBox3.Text)) return;
     var s = new Settings() { Type="Passord", Value = textBox3.Text};
     mc.LagrePassord(s);
     mc.EnableMainWindow();
     Dispose();
 }
Esempio n. 2
0
 public void LagrePass(Settings s)
 {
     var setting = db.Settings.FirstOrDefault(x => x.Type == "Passord");
     if (setting == null)
     {
         setting = new Settings
         {
             Type = "Passord",
             Value = s.Value
         };
         db.Settings.Add(setting);
     }
     else
     {
         setting.Value = s.Value;
     }
     db.SaveChanges();
 }