Exemplo n.º 1
0
        public void deletePerson(string name)
        {
            try
            {
                using (ProjektasEntities database = new ProjektasEntities())
                {
                    var person = (from registracija in database.registrations
                                  where registracija.Name == name
                                  select registracija).FirstOrDefault();
                    database.registrations.Remove(person);

                    database.SaveChanges();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemplo n.º 2
0
 public void addPersonToUsers(string name1, string email1, string password1)
 {
     try
     {
         using (ProjektasEntities database = new ProjektasEntities())
         {
             var person = new user
             {
                 Name = name1,
                 Email = email1,
                 Pass = password1
             };
             database.users.Add(person);
             database.SaveChanges();
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
Exemplo n.º 3
0
        public void updatePerson(string dbName, string name, string email, string password)
        {
            try
            {
                using (ProjektasEntities database = new ProjektasEntities())
                {
                    var person = database.registrations.SingleOrDefault(b => b.Name == dbName);
                    if (person != null)
                    {
                        if (name != "")
                        {
                            person.Name = name;
                        }
                        if (email != "")
                        {
                            person.Email = email;
                        }
                        if (password != "")
                        {
                            person.Pass = password;
                        }

                        database.SaveChanges();
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemplo n.º 4
0
 public void addPersonToRegistration(string name, string email, string password)
 {
     try
     {
         using (ProjektasEntities database = new ProjektasEntities())
         {
             var person = new registration
             {
                 Name = name,
                 Email = email,
                 Pass = password
             };
             database.registrations.Add(person);
             database.SaveChanges();
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }