public StudentManagementApiContext Get() { //return _studentApiContext ?? (_studentApiContext = new StudentManagementApiContext()); if (_studentApiContext != null) { return(_studentApiContext); } else { _studentApiContext = new StudentManagementApiContext(); return(_studentApiContext); } //_dbContext = new ModelContext(); //return _dbContext; }
public override void Up() { StudentManagementApiContext context = new StudentManagementApiContext(); var grades = new List <Grades> { new Grades { GradeId = 1, Grade = "AAA", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now }, new Grades { GradeId = 1, Grade = "BBB", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now }, new Grades { GradeId = 1, Grade = "CCC", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now }, new Grades { GradeId = 1, Grade = "DDD", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now } }; grades.ForEach(s => context.Grades.Add(s)); context.SaveChanges(); }