예제 #1
0
        public bool Ekle(Entities.Lesson data)
        {
            var result = false;

            try
            {
                this.dbContext.Lessons.Add(data);
                this.dbContext.SaveChanges();
                return(result);
            }
            catch (Exception)
            {
            }
            return(result);
        }
예제 #2
0
        /// <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);
        }