public Result <bool> insert_sinhvien(SinhVien_ett sinhvien) { Result <bool> rs = new Result <bool>(); try { // create new tbl_khoa to insert to datacontext tbl_sinhvien temp = new tbl_sinhvien(); temp.masv = sinhvien.masv; temp.hoten = sinhvien.hoten; temp.noisinh = sinhvien.noisinh; temp.makhoa = sinhvien.makhoa; // remember : linq insert data db.tbl_sinhviens.InsertOnSubmit(temp); // remember : all manipulations such as insert, update, delete have to use this command db.SubmitChanges(); rs.data = true; rs.errorCode = ErrorCode.Sucess; return(rs); } catch (Exception e) { rs.data = false; rs.errorCode = ErrorCode.False; rs.errorInfor = e.ToString(); return(rs); } }
public SinhVien_ett(tbl_sinhvien sv) { masv = sv.masv; hoten = sv.hoten; noisinh = sv.noisinh; makhoa = sv.makhoa; }
public ActionResult xoa(string id) { tbl_sinhvien sv = db.tbl_sinhvien.Find(id); db.tbl_sinhvien.Remove(sv); db.SaveChanges(); return(RedirectToAction("Index")); }
public SinhVienCbx_ett(tbl_sinhvien o, string matensv) { masv = o.masv; hoten = o.hoten; noisinh = o.noisinh; makhoa = o.makhoa; this.matensv = matensv; }
private void btn_sua_Click(object sender, EventArgs e) { DataContext db = new DataContext(); tb = db.tbl_sinhviens.Where(s => s.masv == txt_masv.Text).Single(); tb.tensv = txt_tensv.Text; tb.lop = txt_lop.Text; tb.diem = txt_diem.Text; db.SubmitChanges(); Form1_Load(sender, e); }
public Result<bool> insert_sinhvien(SinhVien_ett sinhvien) { Result<bool> rs = new Result<bool>(); try { // create new tbl_khoa to insert to datacontext tbl_sinhvien temp = new tbl_sinhvien(); temp.masv = sinhvien.masv; temp.hoten = sinhvien.hoten; temp.noisinh = sinhvien.noisinh; temp.makhoa = sinhvien.makhoa; // remember : linq insert data db.tbl_sinhviens.InsertOnSubmit(temp); // remember : all manipulations such as insert, update, delete have to use this command db.SubmitChanges(); rs.data = true; rs.errorCode = ErrorCode.Sucess; return rs; } catch (Exception e) { rs.data = false; rs.errorCode = ErrorCode.False; rs.errorInfor = e.ToString(); return rs; } }