static public void DeleteTeen(int id) { TeenNight.DeleteTeenNights(id); using (var db = Code.TeenDataHelper.GetEE()) { var g = db.Teens.Where(x => x.id == id).FirstOrDefault(); if (g == null) { return; } db.Teens.Remove(g); db.SaveChanges(); } }
public void StoreAttendance() { for (int x = 0; x < LstAttended.Count; x++) { var tnd = TeenNight.ReadSingleTeenNights(this.id, DateList[x]); if (tnd == null) { tnd = new TeenNight(); tnd.Attended = LstAttended[x] ? "Y" : "N"; tnd.Decision = LstDecision[x]; tnd.AttendanceDate = DateList[x]; tnd.TeenId = id; tnd.Save(); } else { tnd.Attended = LstAttended[x] ? "Y" : "N"; tnd.Decision = LstDecision[x]; tnd.Update(); } } }