public Khoa_ett(tbl_khoa khoa) { makhoa = khoa.makhoa; tenkhoa = khoa.tenkhoa; diachi = khoa.diachi; dienthoai = khoa.dienthoai; }
public Result <bool> insert_khoa(Khoa_ett khoa) { Result <bool> rs = new Result <bool>(); try { // create new tbl_khoa to insert to datacontext tbl_khoa temp = new tbl_khoa(); temp.makhoa = khoa.makhoa; temp.tenkhoa = khoa.tenkhoa; temp.diachi = khoa.diachi; temp.dienthoai = khoa.dienthoai; // remember : linq insert data db.tbl_khoas.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 Result<bool> insert_khoa(Khoa_ett khoa) { Result<bool> rs = new Result<bool>(); try { // create new tbl_khoa to insert to datacontext tbl_khoa temp = new tbl_khoa(); temp.makhoa = khoa.makhoa; temp.tenkhoa = khoa.tenkhoa; temp.diachi = khoa.diachi; temp.dienthoai = khoa.dienthoai; // remember : linq insert data db.tbl_khoas.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; } }