Beispiel #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 });
 }
Beispiel #2
0
 public ActionResult CreateArticle()
 {
     var vm = new Article
         {
             Date = DateTime.Today,
             IsVisible = true,
             IsOnFrontPage = true
         };
     return View(vm);
 }
Beispiel #3
0
 public ActionResult EditArticle(Article vm)
 {
     if (!ModelState.IsValid)
     {
         return View(vm);
     }
     UpdateModel(Repository.GetArticle(vm.Id));
     Repository.Save();
     return RedirectToAction("articles");
 }
Beispiel #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);
Beispiel #8
0
 public void Delete(Article article)
 {
     _db.PersonToArticles.DeleteAllOnSubmit(article.PersonToArticles);
     _db.BookToArticles.DeleteAllOnSubmit(article.BookToArticles);
     _db.Articles.DeleteOnSubmit(article);
 }
Beispiel #9
0
 public void Add(Article article)
 {
     _db.Articles.InsertOnSubmit(article);
 }