public RoleRepository() { _roleManager = new RoleManager <IdentityRole>( new RoleStore <IdentityRole>( new MyTestingDbEntities(ConnectionStringManager.ConnectionString))); _db = new MyTestingDbEntities(ConnectionStringManager.ConnectionString); }
public StudentModel LoadStudentData(int id) { try { using (var dbContext = new MyTestingDbEntities(ConnectionStringManager.ConnectionStringEF)) { var oStudent = dbContext.Students.SingleOrDefault(s => s.Id == id); var oStudentModel = new StudentModel(); if (oStudent != null) { oStudentModel.Id = oStudent.Id; oStudentModel.Name = oStudent.Name; } return(oStudentModel); } } catch (Exception ex) { int count = 0; } return(null); }