Beispiel #1
0
 /// <summary>
 /// Lägger till en användare i databasen
 /// </summary>
 public void insertUser(Profiles profile, SECURITY security)
 {
     try
     {
         using (var context = new UserDBEntities())
         {
             context.Database.Connection.Open();
             context.Profiles.Add(profile);
             context.SaveChanges();
             security.PID = profile.Id;
             context.SECURITY.Add(security);
             context.SaveChanges();
         }
     }
     catch (Exception e)
     {
     }
 }
Beispiel #2
0
 public void UpdatePassword(int id, string newpass)
 {
     using (var context = new UserDBEntities())
     {
         var user = (from a in context.SECURITY
                     where (a.PID == id)
                     select a).SingleOrDefault();
         user.PASSWORD = newpass;
         context.SaveChanges();
     }
 }
Beispiel #3
0
 public void setPic(int id, string filename)
 {
     using (var context = new UserDBEntities())
     {
         var user = (from a in context.Profiles
                     where (a.Id == id)
                     select a).SingleOrDefault();
         user.Pic = filename;
         context.SaveChanges();
     }
 }
Beispiel #4
0
 public void setPAboutById(int id, string about)
 {
     using (var context = new UserDBEntities())
     {
         var user = (from a in context.Profiles
                     where (a.Id == id)
                     select a).SingleOrDefault();
         user.About = about;
         context.SaveChanges();
     }
 }
Beispiel #5
0
 public void setHide(int id, bool choice)
 {
     using (var context = new UserDBEntities())
     {
         var hide = (from a in context.SECURITY
                     where (a.PID == id)
                     select a).SingleOrDefault();
         if (choice == true)
         {
             hide.VISIBILITY = true;
         }
         if (choice == false)
         {
             hide.VISIBILITY = false;
         }
         context.SaveChanges();
     }
 }