public ActionResult RemoveBookToArticle(BookToArticle vm) { var link = Repository.GetBookToArticle(vm.Id); Repository.Delete(link); Repository.Save(); return RedirectToAction("editarticle", new { id = link.ArticleId }); }
public ActionResult CreateBookToArticle(int id) { var article = Repository.GetArticle(id); if (article == null) return HttpNotFound(); var vm = new BookToArticle { ArticleId = id, Article = article, SequenceIdentifier = int.MaxValue }; ViewBag.Books = LinkableBooksList(vm.BookId); return View(vm); }
public ActionResult CreateBookToArticle(BookToArticle vm) { if (!ModelState.IsValid) { ViewBag.Books = LinkableBooksList(vm.BookId); vm.Article = Repository.GetArticle(vm.ArticleId); return View(vm); } Repository.Add(vm); Repository.Save(); return RedirectToAction("editarticle", new { id = vm.ArticleId }); }
partial void UpdateBookToArticle(BookToArticle instance);
partial void DeleteBookToArticle(BookToArticle instance);
partial void InsertBookToArticle(BookToArticle instance);
private void detach_BookToArticles(BookToArticle entity) { this.SendPropertyChanging(); entity.Article = null; }
private void attach_BookToArticles(BookToArticle entity) { this.SendPropertyChanging(); entity.Article = this; }
public void Delete(BookToArticle link) { _db.BookToArticles.DeleteOnSubmit(link); }
public void Add(BookToArticle link) { _db.BookToArticles.InsertOnSubmit(link); }