public bool Insert(HistoryDetailLessonParam historyDetailLessonParam) { if (historyDetailLessonParam.students.ToString() == " ") { MessageBox.Show("Don't insert white space"); } else { status = _historyDetailLesson.Insert(historyDetailLessonParam); } return(status); }
public bool Insert(HistoryDetailLessonParam historyDetailLessonParam) { var result = 0; historyDetailLesson.students.Id = historyDetailLessonParam.students.Id; historyDetailLesson.detailLessons.Id = historyDetailLessonParam.detailLessons.Id; historyDetailLesson.CreateDate = DateTimeOffset.Now.LocalDateTime; _context.HistoryDetailLessons.Add(historyDetailLesson); result = _context.SaveChanges(); if (result > 0) { status = true; MessageBox.Show("Insert Successfully"); } else { MessageBox.Show("Insert Failed"); } return(status); }
public bool Update(int?id, HistoryDetailLessonParam historyDetailLessonParam) { var result = 0; var historyDetailLesson = Get(id); historyDetailLesson.students.Id = historyDetailLessonParam.students.Id; historyDetailLesson.detailLessons.Id = historyDetailLessonParam.detailLessons.Id; historyDetailLesson.UpdateDate = DateTimeOffset.Now.LocalDateTime; result = _context.SaveChanges(); if (result > 0) { status = true; MessageBox.Show("Update Successfully"); } else { MessageBox.Show("Update Failed"); } return(status); }
public bool Update(int?id, HistoryDetailLessonParam historyDetailLessonParam) { if (_historyDetailLesson.Get(id) == null) { MessageBox.Show("Sorry, your data is not found"); } else if (id.ToString() == " ") { MessageBox.Show("Don't insert white space in Id"); } else { if (historyDetailLessonParam.students.ToString() == " ") { MessageBox.Show("Don't insert white space in Name"); } else { status = _historyDetailLesson.Update(id, historyDetailLessonParam); } } return(status); }