private void attach_tblNews(tblNew entity) { this.SendPropertyChanging(); entity.tblUser = this; }
private void detach_tblNews(tblNew entity) { this.SendPropertyChanging(); entity.tblUser = null; }
partial void DeletetblNew(tblNew instance);
partial void UpdatetblNew(tblNew instance);
partial void InserttblNew(tblNew instance);
/// <summary> /// Cập nhật tin tức /// </summary> /// <param name="recordUpdate"></param> /// <returns></returns> public static Boolean updateNews(int newsID, tblNew recordUpdate) { LTDHDataContext DB = new LTDHDataContext(@strPathDB); try { using (TransactionScope ts = new TransactionScope()) { var news = DB.tblNews.Single(n => n.ID == newsID); news.Title = recordUpdate.Title; news.Chapaeu = recordUpdate.Chapaeu; news.Contents = recordUpdate.Contents; news.Posted = recordUpdate.Posted; news.Author = recordUpdate.Author; DB.SubmitChanges(); ts.Complete(); } } catch (Exception e) { return false; } return true; }
/// <summary> /// Thêm tin tức /// </summary> /// <param name="record"></param> /// <returns>Boolean</returns> public static Boolean insertNews(tblNew record) { LTDHDataContext DB = new LTDHDataContext(@strPathDB); try { using (TransactionScope ts = new TransactionScope()) { DB.tblNews.InsertOnSubmit(record); DB.SubmitChanges(); ts.Complete(); } } catch (Exception e) { return false; } return true; }