public void EditChapter(mst_chapter mst) { try { if (mst.chapter_close) { mst.chapter_end_date = System.DateTime.Now; } else { mst.chapter_end_date = null; } string query = @"UPDATE mst_chapter SET chapter_name = @chapter_name, chapter_end_date = @chapter_end_date WHERE session = @session AND subject_id = @subject_id AND chapter_id = @chapter_id AND section_id = @section_id"; con.Execute(query, mst); } catch (Exception ex) { throw ex; } }
public ActionResult EditChapter(mst_chapter chapter) { mst_chapterMain stdMain = new mst_chapterMain(); stdMain.EditChapter(chapter); return(RedirectToAction("AllChapterList", new { session = chapter.session, subject_id = chapter.subject_id, class_id = chapter.class_id, section_id = chapter.section_id })); }
public ActionResult AddChapter(string session, int class_id, int subject_id, int section_id) { mst_chapter chapter = new mst_chapter(); chapter.class_id = class_id; chapter.subject_id = subject_id; chapter.section_id = section_id; chapter.session = session; return(View(chapter)); }
public void AddChapter(mst_chapter chapter) { try { string query = @"INSERT INTO mst_chapter (session, class_id, section_id, subject_id, chapter_id, chapter_name, chapter_start_date) VALUES (@session, @class_id, @section_id, @subject_id, @chapter_id, @chapter_name, curdate())"; string maxid = @"SELECT IFNULL(MAX(chapter_id), 0) + 1 FROM mst_chapter WHERE session = @session AND subject_id = @subject_id AND class_id = @class_id AND section_id = @section_id"; chapter.chapter_id = con.ExecuteScalar <int>(maxid, new { session = chapter.session, subject_id = chapter.subject_id, class_id = chapter.class_id, section_id = chapter.section_id }); con.Execute(query, chapter); } catch (Exception ex) { throw ex; } }