public static bool InsertDuong(TENDUONG duong) { try { GanMoiDataContext db = new GanMoiDataContext(); db.TENDUONGs.InsertOnSubmit(duong); db.SubmitChanges(); return(true); } catch (Exception) { } return(false); }
public static bool Delete(int id) { GanMoiDataContext db = new GanMoiDataContext(); var query = from duong in db.TENDUONGs where duong.STT == id select duong; TENDUONG tDuong = query.SingleOrDefault(); if (tDuong != null) { try { db.TENDUONGs.DeleteOnSubmit(tDuong); db.SubmitChanges(); return(true); } catch (Exception ex) { } } return(false); }
public static bool UpdateDuong(int id, string tenduong, string maphuong, int maquan) { GanMoiDataContext db = new GanMoiDataContext(); var query = from duong in db.TENDUONGs where duong.STT == id select duong; TENDUONG tDuong = query.SingleOrDefault(); if (tDuong != null) { try { tDuong.DUONG = tenduong; tDuong.MAPHUONG = maphuong; tDuong.MAQUAN = maquan; db.SubmitChanges(); return(true); } catch (Exception) { } } return(false); }