示例#1
0
        public ActionResult Edit(Book book)
        {
            BookStoreClient pc = new BookStoreClient();

            pc.EditBook(book);
            return(RedirectToAction("BookswithAuthors", "BookWithAuthor"));
        }
示例#2
0
        // GET: Books/Delete
        public ActionResult Delete(int id)
        {
            BookStoreClient lc = new BookStoreClient();

            lc.DeleteBook(id);
            return(RedirectToAction("BookswithAuthors", "BookWithAuthor"));
        }
示例#3
0
        // GET: Authors/Delete
        public ActionResult Delete(int id)
        {
            BookStoreClient lc = new BookStoreClient();

            lc.DeleteAuthr(id);
            return(RedirectToAction("Index", "Authors"));
        }
示例#4
0
        public ActionResult Create(Book book)
        {
            BookStoreClient lc = new BookStoreClient();

            lc.CreateBook(book);
            return(RedirectToAction("BookswithAuthors", "BookWithAuthor"));
        }
示例#5
0
        public ActionResult Edit(Author author)
        {
            BookStoreClient pc = new BookStoreClient();

            pc.EditAuthor(author);
            return(RedirectToAction("Index", "Authors"));
        }
示例#6
0
        public ActionResult Create(Author author)
        {
            BookStoreClient lc = new BookStoreClient();

            lc.CreateAuthor(author);
            return(RedirectToAction("Index", "Authors"));
        }
示例#7
0
        // GET: Authors
        public ActionResult Index()
        {
            BookStoreClient lc = new BookStoreClient();

            ViewBag.listAuthors = lc.GetAllAuthors();
            return(View());
        }
示例#8
0
        // GET: BooksWithAuthors
        public ActionResult BookswithAuthors()
        {
            BookStoreClient bwu = new BookStoreClient();

            ViewBag.listBookswithAuthors = bwu.GetAllBookWithAuthors();
            return(View());
        }
示例#9
0
        // 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"));
        }
示例#10
0
        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));
        }
示例#11
0
        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));
        }
示例#12
0
        // 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());
        }
示例#13
0
 public HomeController()
 {
     bookClient  = new BookStoreClient();
     genreClient = new BookGenreClient();
 }