public bool UpdateMsg(int infoid) { //建立資料內文物件 DataClassesDataContext db = new DataClassesDataContext(); //抓取符合條件的記錄 BBSInfo info = db.BBSInfo.First(p => p.InfoID == infoid); //回覆數加1 info.ReplyCount += 1; //修改回覆日期 info.LastReplytime = DateTime.Now.Date; //提交更改 db.SubmitChanges(); return(true); }
public void AddMsg(string title, string user, int categoryid) { //建立資料內文物件 DataClassesDataContext db = new DataClassesDataContext(); //建立新的論壇物件 BBSInfo myinfo = new BBSInfo { Title = title, FileName = getFilename().ToString(), PostTime = DateTime.Now.Date, ReplyCount = 0, LastReplytime = DateTime.Now.Date, PostUser = user, CategoryID = categoryid }; xmlfilename = myinfo.FileName; //添加論壇物件到資料內文 db.BBSInfo.InsertOnSubmit((myinfo)); //提交易動 db.SubmitChanges(); }
partial void DeleteBBSInfo(BBSInfo instance);
partial void UpdateBBSInfo(BBSInfo instance);
partial void InsertBBSInfo(BBSInfo instance);
private void detach_BBSInfo(BBSInfo entity) { this.SendPropertyChanging(); entity.BBSCategory = null; }
private void attach_BBSInfo(BBSInfo entity) { this.SendPropertyChanging(); entity.BBSCategory = this; }