public HistoriesController(FreeLancers4Context context) { _context = context; }
public static void Initialize(IServiceProvider service) { using (var context = new FreeLancers4Context( service.GetRequiredService <DbContextOptions <FreeLancers4Context> >())) { //check for data in table if (context.Work.Any() && context.History.Any()) { return; //DB has been seeded } /* * if(!context.Work.Any()) * { * context.Work.AddRange( * new Work * { * ProjectTitle = "Ted Birthday Website", * Description = "I need a photo album esquie website to celebrate my uncles birthday next year, id like it to be acceabile for everywhere and make it so that i can let people leave comments under the pictures ", * PostDate = DateTime.Parse("2019-3-24"), * Price = 45M,//the m makes it a double * DueDate = DateTime.Parse("2020-4-22"), * Skills = "HTML, CSS, PHP, SQL", * Techneeded = "I dont know", * ContactEmail = "*****@*****.**" * }, * new Work * { * ProjectTitle = "We'll change the rest chill", * Description = "I need a photo album esquie website to celebrate my uncles birthday next year, id like it to be acceabile for everywhere and make it so that i can let people leave comments under the pictures ", * PostDate = DateTime.Parse("2019-3-24"), * Price = 45M,//the m makes it a double * DueDate = DateTime.Parse("2020-4-22"), * Skills = "HTML, CSS, PHP, SQL", * Techneeded = "I dont know", * ContactEmail = "@" * }, * new Work * { * ProjectTitle = "I guess you will ", * Description = "I need a photo album esquie website to celebrate my uncles birthday next year, id like it to be acceabile for everywhere and make it so that i can let people leave comments under the pictures ", * PostDate = DateTime.Parse("2019-3-24"), * Price = 45M,//the m makes it a double * DueDate = DateTime.Parse("2020-4-22"), * Skills = "HTML, CSS, PHP, SQL", * Techneeded = "I dont know", * ContactEmail = "@" * } * );//add some table data * } * * if(!context.History.Any()) * { * context.History.AddRange( * new History * { * * Project = "I need a pineapple rendered in 3d 4k resolution", * UserName = "******", * Proffesion = "Animated/Sculptor", * Rating = 5, * CompleteDate = DateTime.Parse("2019-12-21") * * }, * new History * { * * Project = "I need a web app that allows user to contact freelance developers for i.t projects", * UserName = "******", * Proffesion = "Web App Developer", * Rating = 5, * CompleteDate = DateTime.Parse("2021-2-5") * * } * ); * } */ context.SaveChanges(); } }
public ProjectsController(FreeLancers4Context context, UserManager <FreeLancers4User> userManager) { _context = context; _userManager = userManager; }