//------------------- //Update News public void UpdateNews(string id, string title, string content, Boolean active) { tbl_New news = db_OBTRS.tbl_News.Single(udt => udt.News_ID.Equals((Object)id)); news.News_Title = title; news.News_Content = content; news.News_Active = active; news.News_Edit = DateTime.Now; db_OBTRS.SubmitChanges(); }
//Them tin tuc moi public void AddNews(String tittle, String content, Boolean active) { tbl_New news = new tbl_New(); news.News_Title = tittle; news.News_Content = content; news.News_Active = active; //Thong tin khac news.News_Release = DateTime.Now; news.News_Edit = DateTime.Now; news.News_ID = Guid.NewGuid(); db_OBTRS.tbl_News.InsertOnSubmit(news); db_OBTRS.SubmitChanges(); }
/// <summary> /// Insert news /// </summary> /// <param name="CategoryId"></param> /// <param name="IsApproved"></param> /// <param name="IsFeatured"></param> /// <returns></returns> public static Guid InsertNews(int CategoryId,bool IsApproved, bool IsFeatured) { tbl_New _NewsObj = new tbl_New(); _NewsObj.CategoryId = CategoryId; _NewsObj.DateCreate = DateTime.Now; _NewsObj.IsApproved = IsApproved; _NewsObj.IsFeatured = IsFeatured; try { Enidc.Web.DataHelper.Insert<tbl_New>(_NewsObj); return _NewsObj.NewsId; } catch(Exception ex) { //return new Guid(); throw new Exception(ex.ToString()); } }
/// <summary> /// /// </summary> /// <param name="NewsId"></param> /// <returns></returns> public static tbl_New GetNewsById(Guid NewsId) { tbl_New _OneNews = new tbl_New(); using (enidcDataContext db = Enidc.Web.DataHelper.getEnIdcData()) { try { _OneNews = db.tbl_News.Where(i => i.NewsId.Equals(NewsId)).SingleOrDefault(); } catch { } } return _OneNews; }
partial void Deletetbl_New(tbl_New instance);
partial void Updatetbl_New(tbl_New instance);
partial void Inserttbl_New(tbl_New instance);
private void detach_tbl_News(tbl_New entity) { this.SendPropertyChanging(); entity.tbl_Category = null; }