public static void Initialize(StudDbContext context)
 {
     if (!context.Students.Any())
     {
         context.Students.AddRange(
             new Student
         {
             FirstName  = "iPhone X",
             LastNAme   = "Apple",
             MiddleName = "leon",
             Sex        = "муж",
             CallName   = "dfgdfg"
         },
             new Student
         {
             FirstName  = "iPhone X",
             LastNAme   = "Apple",
             MiddleName = "leon",
             Sex        = "жен",
             CallName   = "dfgdfg"
         }
             );
         context.SaveChanges();
     }
 }
 public StudentsController(StudDbContext context)
 {
     _context = context;
 }
Exemple #3
0
 public HomeController(StudDbContext context)
 {
     db = context;
 }