public bool LuuCuDan(CuDanModel cdm) { try { DB_QuanLyChungCuDataContext context = new DB_QuanLyChungCuDataContext(); CuDan cd = new CuDan { MaCuDan = cdm.MaCuDan, TenCuDan = cdm.TenCuDan, GioiTinh = cdm.GioiTinh, NgaySinh = cdm.NgaySinh, SoDT = cdm.SoDT, SoCMT = cdm.SoCMT, QueQuan = cdm.QueQuan }; context.CuDans.InsertOnSubmit(cd); context.SubmitChanges(); return(true); } catch { } return(false); }
public bool SuaCuDan(CuDanModel cdm) { try { DB_QuanLyChungCuDataContext context = new DB_QuanLyChungCuDataContext(); CuDan cd = context.CuDans.FirstOrDefault(x => x.MaCuDan == cdm.MaCuDan); if (cd != null) { cd.TenCuDan = cdm.TenCuDan; cd.GioiTinh = cdm.GioiTinh; cd.NgaySinh = cdm.NgaySinh; cd.SoDT = cdm.SoDT; cd.SoCMT = cdm.SoCMT; cd.QueQuan = cdm.QueQuan; context.SubmitChanges(); return(true); } } catch { } return(false); }