public void Seed() { if (!Faculties.Any()) { Faculties.Add(new Faculty { Name = "FNWI" }); SaveChanges(); } if (!SecurityQuestions.Any()) { List <SecurityQuestions> questions = new List <SecurityQuestions>(); void AddQuestion(string text, DeviceType mask) { questions.Add(new Data.SecurityQuestions() { Text = text, Mask = mask, }); } AddQuestion("Does the device have encrypted storage?", DeviceType.All); AddQuestion("Are local accounts only accessible with strong passwords?", DeviceType.All); AddQuestion("Does the device have a strong access code(minimum 6 characters) other than the SIM card PIN code?", DeviceType.Mobile | DeviceType.Tablet); AddQuestion("The OS and all applications are maintained by a supplier or community, and are up to date including security updates.", DeviceType.All); AddQuestion("Applicable anti malware and antivirus solutions are present, active and up to date.", DeviceType.All); AddQuestion("Local (application) firewall is active and alerts the user to unusual behaviour.", DeviceType.Desktop | DeviceType.Laptop); AddQuestion("Laptop or desktop should be automatically locked after a pre-set period of inactivity after a maximum of 15 minutes and phones or tablets after 5 minutes.", DeviceType.Desktop | DeviceType.Laptop); AddQuestion("Remote wipe, lock, or effective data protection measures to prevent loss of setting information in the event of theft should be in place.", DeviceType.All); SecurityQuestions.AddRange(questions); SaveChanges(); } int facultyId = Faculties.First(f => f.Name == "FNWI").Id; var userIds = new string[] { User.ImporterId, User.IntuneServiceId, User.LabnetId, User.ExpireId }; foreach (string id in userIds) { if (!Users.Any(u => u.UserName == id)) { Users.Add(new User() { Name = id, UserName = id, FacultyId = facultyId, Email = "*****@*****.**", }); SaveChanges(); } } }