public ActionResult Edit(Book book) { BookStoreClient pc = new BookStoreClient(); pc.EditBook(book); return(RedirectToAction("BookswithAuthors", "BookWithAuthor")); }
// GET: Books/Delete public ActionResult Delete(int id) { BookStoreClient lc = new BookStoreClient(); lc.DeleteBook(id); return(RedirectToAction("BookswithAuthors", "BookWithAuthor")); }
// GET: Authors/Delete public ActionResult Delete(int id) { BookStoreClient lc = new BookStoreClient(); lc.DeleteAuthr(id); return(RedirectToAction("Index", "Authors")); }
public ActionResult Create(Book book) { BookStoreClient lc = new BookStoreClient(); lc.CreateBook(book); return(RedirectToAction("BookswithAuthors", "BookWithAuthor")); }
public ActionResult Edit(Author author) { BookStoreClient pc = new BookStoreClient(); pc.EditAuthor(author); return(RedirectToAction("Index", "Authors")); }
public ActionResult Create(Author author) { BookStoreClient lc = new BookStoreClient(); lc.CreateAuthor(author); return(RedirectToAction("Index", "Authors")); }
// GET: Authors public ActionResult Index() { BookStoreClient lc = new BookStoreClient(); ViewBag.listAuthors = lc.GetAllAuthors(); return(View()); }
// GET: BooksWithAuthors public ActionResult BookswithAuthors() { BookStoreClient bwu = new BookStoreClient(); ViewBag.listBookswithAuthors = bwu.GetAllBookWithAuthors(); return(View()); }
// GET: Authors/Create public ActionResult Create() { BookStoreClient lc = new BookStoreClient(); ViewBag.listEmploymentStatus = lc.GetEmplyeeStatusIdNameMVCModel().Select(x => new SelectListItem { Value = x.NAME, Text = x.NAME }); return(View("Create")); }
public ActionResult Edit(int id) { BookStoreClient lc = new BookStoreClient(); Author author = new Author(); ViewBag.listEmploymentStatus = lc.GetEmplyeeStatusIdNameMVCModel().Select(x => new SelectListItem { Value = x.NAME, Text = x.NAME }); author = lc.GetAuthor(id); return(View("Edit", author)); }
public ActionResult Edit(int id) { BookStoreClient lc = new BookStoreClient(); Book book = new Book(); book = lc.GetBook(id); ViewBag.listAuthors = lc.GetAuthorsIdName().Select(x => new SelectListItem { Value = x.ID.ToString(), Text = x.NAME }); ViewBag.listEditions = lc.GetEditionIdNameMVCModel().Select(x => new SelectListItem { Value = x.NAME, Text = x.NAME }); return(View("Edit", book)); }
// GET: Books/Create public ActionResult Create() { BookStoreClient lc = new BookStoreClient(); // NonStrongly Type //------------------------------------------ //Method 1 //ViewBag.listAuthors = new SelectList(lc.GetAuthorsIdName(), "ID", "NAME"); //Method 2 ViewBag.listAuthors = lc.GetAuthorsIdName().Select(x => new SelectListItem { Value = x.ID.ToString(), Text = x.NAME }); //------------------------------------------ // Strongly Type //------------------------------------------ /* * Book model = new Book * { * //Method 1 * Authors = new SelectList(lc.GetAuthorsIdName(), "ID", "NAME"); * //Method 2 * Authors = lc.GetAuthorsIdName().Select(x => new SelectListItem { Value = x.ID.ToString(), Text = x.NAME }) * }; * * return View(model); * //------------------------------------------ */ ViewBag.listEditions = lc.GetEditionIdNameMVCModel().Select(x => new SelectListItem { Value = x.NAME, Text = x.NAME }); return(View()); }
public HomeController() { bookClient = new BookStoreClient(); genreClient = new BookGenreClient(); }