public bool Ekle(Entities.Lesson data) { var result = false; try { this.dbContext.Lessons.Add(data); this.dbContext.SaveChanges(); return(result); } catch (Exception) { } return(result); }
/// <summary> /// As is the case with IsGradeValid, ideally I would have some sort of Validation /// class to run items through, but for this exercise I'm just using a simple private /// method for demonstration. /// </summary> /// <param name="lesson"></param> /// <returns></returns> private bool IsLessonValid(Entities.Lesson lesson) { // just doing a null check, but this could be something more extensive return(lesson != null); }