Beispiel #1
0
        public void SaveChangesRelatives(List <string[]> listUserData)
        {
            for (int i = 1; i < listUserData.Count; i++)
            {
                int?parentUser = ParentAttribute.ParentDefinition(listUserData[i][4]);

                Relative relative = new Relative
                {
                    ParentId = parentUser
                };
                Database.Relatives.Add(relative);
            }
            Database.SaveChanges();
        }
Beispiel #2
0
        public void SaveChangesUsers(List <string[]> listUserData)
        {
            for (int i = 1; i < listUserData.Count; i++)
            {
                bool genderUser = GenderAttribute.GenderDefinition(listUserData[i][3]);

                int? parentUser = ParentAttribute.ParentDefinition(listUserData[i][4]);
                User user       = new User
                {
                    Name      = listUserData[i][1].Trim(),
                    DateBirth = Convert.ToDateTime(listUserData[i][2]),
                    Gender    = genderUser,
                    ParentId  = parentUser
                };
                Database.Users.Add(user);
            }
            Database.SaveChanges();
        }