Пример #1
0
        public ActionResult Create(PostModelBase model)
        {
            try
            {
                var result=this.ArticleService.AddNewArticle(model);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Пример #2
0
        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();
        }
Пример #3
0
 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;
 }
Пример #4
0
        public ActionResult Edit(int id, PostModelBase model)
        {
            try
            {
                // TODO: Add update logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Пример #5
0
        public ActionResult Delete(int id, PostModelBase model)
        {
            try
            {
                //this.ArticleService.DeletePost(model);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }