public ActionResult Create(PostModelBase model) { try { var result=this.ArticleService.AddNewArticle(model); return RedirectToAction("Index"); } catch { return View(); } }
public ArticleOpResult AddNewArticle(PostModelBase model) { Article article = this.GetNewArticle(); article.Tittle = model.TopicName; if(model.PostContentType == PostContentType.TextContents) { var temp= model as ContentPostModel; article.TextContents.Add(new TextContent() { }); } else { var temp=model as VotePostModle; article.Votes.Add(new Vote() { }); } this.Articles.Add(article); this.DBContext.SaveChanges(); throw new NotImplementedException(); }
public Article PostModelToArticle(PostModelBase po) { Article article = this.GetNewArticle(); article.Tittle = po.TopicName; article.AddTime = po.AddDateTime; article.ArticleID = po.SubjectID; article.Subject.Name = po.SubjectName; return null; }
public ActionResult Edit(int id, PostModelBase model) { try { // TODO: Add update logic here return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Delete(int id, PostModelBase model) { try { //this.ArticleService.DeletePost(model); return RedirectToAction("Index"); } catch { return View(); } }