Exemplo n.º 1
0
        // Static Meathod To Get the Language for the Master page Nav
        public static IEnumerable <Language> GetLanguages()
        {
            BookRepositary         IBookRepos = new BookRepositary();
            IEnumerable <Language> languages  = IBookRepos.GetAllLanguages();

            return(languages);
        }
Exemplo n.º 2
0
        // Static Meathod To Get the Genres for the Master page Nav
        public static IEnumerable <Genre> GetGenres()
        {
            BookRepositary      IBookRepos = new BookRepositary();
            IEnumerable <Genre> Generes    = IBookRepos.GetAllGenres();

            return(Generes);
        }
Exemplo n.º 3
0
        public ActionResult Views()
        {
            IEnumerable <Book> booksList = BookRepositary.GetAllBooks();
            IEnumerable <User> usersList = UserRepositary.GetAllUsers();

            ViewBag.books     = booksList;
            ViewData["Users"] = usersList;
            return(View());
        }
Exemplo n.º 4
0
 public ActionResult Create(Book book)
 {
     if (ModelState.IsValid)
     {
         BookRepositary.Add(book);
         TempData["Message"] = "Added Successfully";
     }
     return(View(book));
 }
Exemplo n.º 5
0
 public ActionResult Update(Book book)
 {
     if (ModelState.IsValid)
     {
         BookRepositary.Updata(book);
         TempData["Message"] = "Updated Successfully";
         return(RedirectToAction("Index"));
     }
     return(View("Edit", book));
 }
Exemplo n.º 6
0
        public void viewBooks()
        {
            BookRepositary obj = new BookRepositary();

            obj.addbBookIntoList();
            foreach (KeyValuePair <int, Book> book in obj.BookList)
            {
                Console.WriteLine("Book ID : {0} \n Title : {1} \n Author : {2} \n Genere : {3} \n Price : {4} \n No Of Pages : {5} \n", book.Key, book.Value.Title, book.Value.Author, book.Value.Genere, book.Value.Price, book.Value.NoOfPages);
            }
        }
Exemplo n.º 7
0
        public void getBook(string title, string author, string genere, int price, int noOfPages)
        {
            Book book = new Book
            {
                // SellerID=
                Title     = title,
                Author    = author,
                Genere    = genere,
                Price     = price,
                NoOfPages = noOfPages
            };

            BookRepositary bookRepos = new BookRepositary();

            if (bookRepos.addBook(book) >= 1)
            {
                Console.WriteLine("\nBook Added...");
            }
            else
            {
                Console.WriteLine("\nBook Does not Added...");
            }
        }
Exemplo n.º 8
0
        public bool getBook(string title, string author, string genere, int price, int noOfPages)
        {
            Book book = new Book
            {
                // SellerID=
                Title     = title,
                Author    = author,
                Genere    = genere,
                Price     = price,
                NoOfPages = noOfPages
            };

            BookRepositary bookRepos = new BookRepositary();

            if (bookRepos.addBook(book) >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 9
0
        public ActionResult Home()
        {
            IEnumerable <Book> books = BookRepositary.GetAllBooks();

            return(View(books));
        }
Exemplo n.º 10
0
 public ActionResult Delete(int id)
 {
     BookRepositary.Delete(id);
     TempData["Message"] = "Deleted Successfully";
     return(RedirectToAction("Index"));
 }
Exemplo n.º 11
0
        public ActionResult Edit(int id)
        {
            Book book = BookRepositary.GetBookByID(id);

            return(View(book));
        }
Exemplo n.º 12
0
        // GET: Book
        public ActionResult Index()
        {
            IEnumerable <Book> Books = BookRepositary.GetAllBooks();

            return(View(Books));
        }
Exemplo n.º 13
0
        static void initializeBooksList()
        {
            BookRepositary obj = new BookRepositary();

            obj.addbBookIntoList();
        }