public void Add(PhoneType item) { if (item != null) { Entities.Add(item); _context.SaveChanges(); } }
public void Add(PrivilegesGroup item) { if (item != null) { Entities.Add(item); _context.SaveChanges(); } }
public void Add(User item) { if (item != null) { Entities.Add(item); _context.SaveChanges(); } }
public static List <Privilege> SetupData(ZeraLeviContext ctx, int count) { var privilegeGroup = GenFu.GenFu.New <PrivilegesGroup>(); var privileges = new List <Privilege>(); var generatedPrivileges = GenFu.GenFu.ListOf <Privilege>(count); foreach (var gP in generatedPrivileges) { if (privileges.Find(p => p.Name.Equals(gP.Name, StringComparison.CurrentCultureIgnoreCase)) == null) { privileges.Add(gP); } } while (privileges.Count < count) { generatedPrivileges = GenFu.GenFu.ListOf <Privilege>(count); foreach (var gP in generatedPrivileges) { if (privileges.Find(p => p.Name.Equals(gP.Name, StringComparison.CurrentCultureIgnoreCase)) == null) { privileges.Add(gP); } } } privilegeGroup.Privileges = privileges.Take(count).ToList(); ctx.PrivilegesGroups.Add(privilegeGroup); ctx.SaveChanges(); return(privilegeGroup.Privileges.ToList()); }
public static Person SetupData(ZeraLeviContext ctx) { var person = GenFuSetup(1, Enumerable.Empty <string>()).First(); ctx.People.Add(person); ctx.SaveChanges(); return(person); }
public static List <PrivilegesGroup> SetupData(ZeraLeviContext ctx, int count) { var items = GenFuSetup(count); ctx.PrivilegesGroups.AddRange(items); ctx.SaveChanges(); return(items); }
public static PrivilegesGroup SetupData(ZeraLeviContext ctx) { var item = GenFuSetup(1).First(); ctx.PrivilegesGroups.Add(item); ctx.SaveChanges(); return(item); }
public static List <PhoneType> SetupData(ZeraLeviContext ctx, int count) { var items = GenFuSetup(count, Enumerable.Empty <string>()); ctx.PhoneTypes.AddRange(items); ctx.SaveChanges(); return(items); }
public static PhoneType SetupData(ZeraLeviContext ctx) { var phoneType = GenFuSetup(1, Enumerable.Empty <string>()).First(); ctx.PhoneTypes.Add(phoneType); ctx.SaveChanges(); return(phoneType); }
public static User SetupData(ZeraLeviContext ctx) { var user = GenFuSetup(1, Enumerable.Empty <string>(), Enumerable.Empty <Privilege>()).First(); ctx.Users.Add(user); ctx.SaveChanges(); return(user); }
public static List <User> SetupData(ZeraLeviContext ctx, int count) { var users = GenFuSetup(count, Enumerable.Empty <string>(), Enumerable.Empty <Privilege>()); ctx.Users.AddRange(users); ctx.SaveChanges(); return(users); }
public static List <Person> SetupData(ZeraLeviContext ctx, int count) { var people = GenFuSetup(count, Enumerable.Empty <string>()); ctx.People.AddRange(people); ctx.SaveChanges(); return(people); }
public static PhoneNumber SetupData(ZeraLeviContext ctx) { GenFuSetup(); var person = GenFu.GenFu.New <Person>(); person.PhoneNumbers = GenFu.GenFu.ListOf <PhoneNumber>(1); ctx.People.Add(person); ctx.SaveChanges(); return(person.PhoneNumbers.First()); }
public static Donation SetupData(ZeraLeviContext ctx) { var person = GenFu.GenFu.New <Person>(); person.Account = GenFu.GenFu.New <Account>(); person.Account.Donations = GenFu.GenFu.ListOf <Donation>(); ctx.People.Add(person); ctx.SaveChanges(); return(person.Account.Donations.First()); }
public static List <Yahrtzieht> SetupData(ZeraLeviContext ctx, int count) { var people = GenFu.GenFu.ListOf <Person>(count); var items = new List <Yahrtzieht>(); foreach (var person in people) { var yahrtziehts = GenFu.GenFu.ListOf <Yahrtzieht>(count); person.Yahrtziehts = yahrtziehts; items.AddRange(yahrtziehts); } ctx.People.AddRange(people); ctx.SaveChanges(); return(items); }
public static List <Account> SetupData(ZeraLeviContext ctx, int count) { var people = GenFu.GenFu.ListOf <Person>(count); var accounts = new List <Account>(); foreach (var person in people) { var account = GenFu.GenFu.New <Account>(); person.Account = account; accounts.Add(account); } ctx.People.AddRange(people); ctx.SaveChanges(); return(accounts); }
public static List <PhoneNumber> SetupData(ZeraLeviContext ctx, int count) { GenFuSetup(); var people = GenFu.GenFu.ListOf <Person>(count); var phoneNumbers = new List <PhoneNumber>(); foreach (var person in people) { var phoneNumber = GenFu.GenFu.ListOf <PhoneNumber>(); person.PhoneNumbers = phoneNumber; phoneNumbers.AddRange(phoneNumber); } ctx.People.AddRange(people); ctx.SaveChanges(); return(phoneNumbers); }
public static List <Donation> SetupData(ZeraLeviContext ctx, int count) { var people = GenFu.GenFu.ListOf <Person>(count); var allDonations = new List <Donation>(); foreach (var person in people) { person.Account = GenFu.GenFu.New <Account>(); var donations = GenFu.GenFu.ListOf <Donation>(count); person.Account.Donations = donations; allDonations.AddRange(donations); } ctx.People.AddRange(people); ctx.SaveChanges(); return(allDonations); }