public ActionResult XinRoi(SinhVienRoiModel model) { var dal = new SinhVienDAL(); int idPLT = dal.CheckIDSinhVienInPhieuLuuTru(model.IDSinhVien); if (idPLT > 0) { var svRoi = new PHIEUXINROI(); svRoi.IDPhieuLuuTru = idPLT; svRoi.LyDoRoi = model.LyDoRoi; svRoi.NgayXinRoi = DateTime.Now; svRoi.TrangThai = false; var result = dal.ThemSinhVienRoi(svRoi); if (result > 0) { MsgBox("Nộp đơn xin rời thành công"); model = new SinhVienRoiModel(); } else { MsgBox("Nộp đơn xin rời thất bại"); } } else { MsgBox("Bạn đã rời Ký Túc Xá"); } return(View()); }
public int ThemSinhVienRoi(PHIEUXINROI sv) { db.PHIEUXINROIs.Add(sv); db.SaveChanges(); return(sv.IDPhieuXinRoi); }