Ejemplo n.º 1
0
        public static void SetUsers(List <User> users)
        {
            SeContext seContext = new SeContext();

            users.ForEach(a => seContext.User.Add(a));
            seContext.SaveChanges();
        }
Ejemplo n.º 2
0
        public static void SetRoles(List <Role> roles)
        {
            SeContext seContext = new SeContext();

            roles.ForEach(a => seContext.Role.Add(a));
            seContext.SaveChanges();
        }
Ejemplo n.º 3
0
        public static void SetLookupTypes(List <LookupType> lookupTypes)
        {
            SeContext seContext = new SeContext();

            lookupTypes.ForEach(a => seContext.LookupType.Add(a));
            seContext.SaveChanges();
        }
Ejemplo n.º 4
0
        public static void SetLogs(List <Log> logs)
        {
            SeContext seContext = new SeContext();

            logs.ForEach(a => seContext.Log.Add(a));
            seContext.SaveChanges();
        }
Ejemplo n.º 5
0
        public static void SetUserRoles(List <UserRole> userRoles)
        {
            var seContext = new SeContext();

            userRoles.ForEach(a => seContext.UserRole.Add(a));
            seContext.SaveChanges();
        }
Ejemplo n.º 6
0
        public static void SetLookupItems(List <LookupItem> lookupItems)
        {
            var seContext = new SeContext();

            lookupItems.ForEach(a => seContext.LookupItem.Add(a));
            seContext.SaveChanges();
        }
Ejemplo n.º 7
0
        public static void ClearDatabase()
        {
            SeContext seContext     = new SeContext();
            var       existingUsers = seContext.User
                                      .Include("PreviousPasswords")
                                      .Include("UserLogs")
                                      .Include("UserRoles")
                                      .ToList();

            existingUsers.ForEach(a => { a.PreviousPasswords.ToList().ForEach(b => seContext.SetDeleted(b)); });
            existingUsers.ForEach(a => { a.UserLogs.ToList().ForEach(b => seContext.SetDeleted(b)); });
            existingUsers.ForEach(a => { a.UserRoles.ToList().ForEach(b => seContext.SetDeleted(b)); });
            seContext.SaveChanges();
            existingUsers.ForEach(a => { seContext.SetDeleted(a); });
            var lookupItems = seContext.LookupItem.ToList();

            foreach (var lookupItem in lookupItems)
            {
                seContext.SetDeleted(lookupItem);
            }
            seContext.SaveChanges();
            var lookupTypes = seContext.LookupType.ToList();

            foreach (var lookupType in lookupTypes)
            {
                seContext.SetDeleted(lookupType);
            }
            seContext.SaveChanges();
            var logs = seContext.Log.ToList();

            foreach (var log in logs)
            {
                seContext.SetDeleted(log);
            }
            seContext.SaveChanges();
        }