public static void Initialize(MetaBookAPIContext context) { if (context is null) { throw new ArgumentNullException(nameof(context)); } AddSomeone(context); }
public EventsController(MetaBookAPIContext context) { _context = context; }
private static void AddSomeone(MetaBookAPIContext context) { if (context.People.Any()) { return; } // Build a house Address addys = new Address() { CityName = "Louisville", StateName = State.KY, StreetName = "3045 Wedgewood Wampum Way", PostalCode = 40101, AddressType = BuildingType.Home }; // Set up your phone line Phone cell = new Phone() { CallerType = PhoneType.Home, PhoneNumber = 8889888452, }; // Make yourself. Person book = new Person { FirstName = "Tony", LastName = "Thigpen", Email = "*****@*****.**", Website = "https://www.tonythigpen.com" }; book.Addresses.Add(addys); context.SaveChanges(); book.Phones.Add(cell); context.SaveChanges(); context.People.Add(book); context.SaveChanges(); Moment[] happening = new Moment[] { new Moment() { Name = "The Happening", Location = "Tampa, FL", StartTime = new DateTime(2019, 9, 3, 12, 0, 0), EndTime = new DateTime(2019, 9, 3, 18, 0, 0), Description = "There is a thing that is happening and you should definitely be in the know about it.", }, new Moment() { Name = "The Next Happening", Location = "Tampa, FL", StartTime = new DateTime(2019, 9, 3, 12, 0, 0), EndTime = new DateTime(2019, 9, 3, 18, 0, 0), Description = "Well, it's happening again.", } }; foreach (var item in happening) { item.Participants.Add(book); context.Events.Add(item); } context.SaveChanges(); // Add the todo list items. Todo[] todolist = GetTodolist(); foreach (var item in todolist) { context.Tasks.Add(item); } context.SaveChanges(); }
public TasksController(MetaBookAPIContext context) { _context = context; }
public PeopleController(MetaBookAPIContext context, UserManager <MetaUser> userManager) { _context = context ?? throw new ArgumentNullException(nameof(context)); _userManager = userManager ?? throw new ArgumentNullException(nameof(userManager)); }