public ActionResult EditAuthor(AuthorModel Author) { if (Author != null) { this.IAuthorInfoDataProvider.Update(Author.GetEntity()); } return RedirectToAction("Index"); }
public ActionResult AddAuthor(AuthorModel Author) { AuthorInfo AuthorInfo = Author.GetEntity(); this.IAuthorInfoDataProvider.Add(AuthorInfo); return RedirectToAction("Index"); }
public ActionResult EditAuthor(long id) { AuthorModel author = new AuthorModel(); AuthorInfo authorInfo = this.IAuthorInfoDataProvider.GetAuthorListByID(id); if (authorInfo != null) { author = AuthorModel.GetViewModel(authorInfo); } return View(author); }
public static AuthorModel GetViewModel(AuthorInfo author) { AuthorModel model = new AuthorModel(); model.ID = author.ID; model.AuthorName = author.AuthorName; model.AuthorIntroduction = author.AuthorIntroduction; if (author.BookAndAuthors.Count > 0) { model.IsUse = true; } return model; }
public ActionResult AddAuthor() { AuthorModel Author = new AuthorModel(); return View(Author); }