public tacgia_ett(tbl_tacgia tg) { matacgia = tg.matg; tentacgia = tg.tentg; diachi = tg.diachi; gioitinh = tg.gioitinh; }
public Result <bool> insert_tacgia(tacgia_ett tacgia) { Result <bool> rs = new Result <bool>(); try { // create new tbl_tacgia to insert to database_context tbl_tacgia temp = new tbl_tacgia(); temp.tentg = tacgia.tentacgia; temp.gioitinh = tacgia.gioitinh; temp.diachi = tacgia.diachi; db.tbl_tacgias.InsertOnSubmit(temp); db.SubmitChanges(); rs.data = true; rs.errcode = ErrorCode.sucess; return(rs); } catch (Exception e) { rs.data = false; rs.errcode = ErrorCode.fail; rs.errInfor = e.ToString(); return(rs); } }
public Result<bool> insert_tacgia(tacgia_ett tacgia) { Result<bool> rs = new Result<bool>(); try { // create new tbl_tacgia to insert to database_context tbl_tacgia temp = new tbl_tacgia(); temp.tentg = tacgia.tentacgia; temp.gioitinh = tacgia.gioitinh; temp.diachi = tacgia.diachi; db.tbl_tacgias.InsertOnSubmit(temp); db.SubmitChanges(); rs.data = true; rs.errcode = ErrorCode.sucess; return rs; } catch (Exception e) { rs.data = false; rs.errcode = ErrorCode.fail; rs.errInfor = e.ToString(); return rs; } }