public void Save(SchoolCheckIn.CheckIn.Model.Class classModel) { PetaPoco.Database db = new PetaPoco.Database("DatabaseConn"); db.BeginTransaction(); try { _classService.Class(db); _classService.SaveClass(classModel); db.CompleteTransaction(); } catch (Exception e) { db.AbortTransaction(); throw e; } }
public List <Model.Student> GetStudentList(string name, string className, DateTime startClassTime, DateTime endClassTime) { try { using (var db = new PetaPoco.Database("databaseConn")) { _studentService.Student(db); _classService.Class(db); var list = _studentService.GetStudentList(name, className, startClassTime, endClassTime); foreach (var item in list) { item.ClassPackage = _classService.GetClassListByStudent(item); } return(list); } } catch (Exception e) { throw e; } }