protected void btnSave_Click(object sender, EventArgs e) { if (checkValidation()) { using (ModelTutor obj = new ModelTutor()) { tblCourse newCourse = new tblCourse { CourseCode = txtCourseCode.Text.Trim(), Name = txtCourseName.Text.Trim() }; try { obj.AddTotblCourses(newCourse); obj.SaveChanges(); DataClear(); //CourseEntity.DataBind(); GridView1.DataBind(); } catch (Exception) { } } } }
/// <summary> /// Create a new tblCourse object. /// </summary> /// <param name="courseId">Initial value of the CourseId property.</param> public static tblCourse CreatetblCourse(global::System.Int32 courseId) { tblCourse tblCourse = new tblCourse(); tblCourse.CourseId = courseId; return tblCourse; }
/// <summary> /// Deprecated Method for adding a new object to the tblCourses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTotblCourses(tblCourse tblCourse) { base.AddObject("tblCourses", tblCourse); }