Example #1
0
 public ActionResult CreateArticle(Article vm)
 {
     if (!ModelState.IsValid)
     {
         return View(vm);
     }
     Repository.Add(vm);
     Repository.Save();
     return RedirectToAction("editarticle", new { id = vm.Id });
 }
Example #2
0
 public ActionResult CreateArticle()
 {
     var vm = new Article
         {
             Date = DateTime.Today,
             IsVisible = true,
             IsOnFrontPage = true
         };
     return View(vm);
 }
Example #3
0
 public ActionResult EditArticle(Article vm)
 {
     if (!ModelState.IsValid)
     {
         return View(vm);
     }
     UpdateModel(Repository.GetArticle(vm.Id));
     Repository.Save();
     return RedirectToAction("articles");
 }
Example #4
0
 public ActionResult DeleteArticle(Article vm)
 {
     Repository.Delete(Repository.GetArticle(vm.Id));
     Repository.Save();
     return RedirectToAction("articles");
 }
 partial void DeleteArticle(Article instance);
 partial void UpdateArticle(Article instance);
 partial void InsertArticle(Article instance);
Example #8
0
 public void Delete(Article article)
 {
     _db.PersonToArticles.DeleteAllOnSubmit(article.PersonToArticles);
     _db.BookToArticles.DeleteAllOnSubmit(article.BookToArticles);
     _db.Articles.DeleteOnSubmit(article);
 }
Example #9
0
 public void Add(Article article)
 {
     _db.Articles.InsertOnSubmit(article);
 }