Ejemplo n.º 1
0
 public int AddArticle(Article article)
 {
     if (article.ID == 0)
     {
         _context.BlogRepository.Add(article.ForSql());
     }
     _context.SaveChanges();
     return _context.BlogRepository.Where(x => x.UserID == article.UserID).Max(y => y.ID);
 }
Ejemplo n.º 2
0
 public void EditArticle(Article article, int userID)
 {
 }
Ejemplo n.º 3
0
 public ActionResult SaveArticle(Article article)
 {
     Article temp;
     temp = article.ID != 0 ? _blogRepository.GetArticle(article.ID) : new Article();
     temp.Text = article.Text;
     temp.ArticleShortName = article.ArticleShortName;
     temp.Date = DateTime.Now;
     temp.UserID = GetUserID();
     _blogRepository.AddArticle(temp);
     ViewBag.Article = _blogRepository.LastArticle.Text;
     return RedirectToAction("Index");
 }