public static bool Delete(KhachHangGroup data) { try { if (data != null) { dbContext.KhachHangGroups.DeleteOnSubmit(data); dbContext.SubmitChanges(); return true; } return false; } catch { //log } NewConnection(); return false; }
private static bool Insert(KhachHangGroup data) { try { dbContext.KhachHangGroups.InsertOnSubmit(data); dbContext.SubmitChanges(); return true; } catch { return false; } }
public static bool Update(KhachHangGroup data) { try { if (data != null) { dbContext.SubmitChanges(); return true; } return false; } catch { return false; } }
/// <summary> /// Insert new data /// </summary> /// <param name="ten"></param> /// <param name="ghiChu"></param> /// <returns>Return id of the new data if success</returns> public static int? Insert(string ten, string ghiChu = "") { int? res = null; try { KhachHangGroup data = new KhachHangGroup(); data.Ten = ten; data.GhiChu = ghiChu; if (Insert(data)) { res = data.Id; } } catch (Exception ex) { throw ex; } return res; }
partial void DeleteKhachHangGroup(KhachHangGroup instance);
partial void UpdateKhachHangGroup(KhachHangGroup instance);
partial void InsertKhachHangGroup(KhachHangGroup instance);