public void SubmitArticle(string url, string title, string owner) { Article arr = new Article() { URL = url, Title = title, Diggers = owner, submittedDate = DateTime.Now }; RedditCloneDataContext dc = new RedditCloneDataContext(); dc.Articles.InsertOnSubmit(arr); dc.SubmitChanges(); var article = (from arr1 in dc.Articles where arr1.URL== url orderby arr1.submittedDate descending select arr1); Article arrNew = article.ToList()[0]; VoteHistory vHis = new VoteHistory() { articleID = arrNew.id, diggers = owner, voteChoice=(int)VoteChoiceEnum.UpVote }; // RedditCloneDataContext dc1= new RedditCloneDataContext(); dc.VoteHistories.InsertOnSubmit(vHis); dc.SubmitChanges(); }
private void detach_Articles(Article entity) { this.SendPropertyChanging(); entity.UserInfo = null; }
private void attach_Articles(Article entity) { this.SendPropertyChanging(); entity.UserInfo = this; }
partial void DeleteArticle(Article instance);
partial void UpdateArticle(Article instance);
partial void InsertArticle(Article instance);