// GET: /AdminBook/AddBook
        public ActionResult AddBook()
        {
            if (Session["UserID"] != null)
            {
                if (Session["Role"].Equals("member"))
                {
                    return RedirectToAction("Index", "Member");
                }
            }
            else
            {
                return RedirectToAction("Login", "Account");
            }
            List<string> authorlist = new List<string>();
            AdminBookDAL dalAuthObj = new AdminBookDAL();
            authorlist = dalAuthObj.BookAuthorList();
            ViewBag.BookAuthorList = authorlist;

            List<string> genrelist = new List<string>();
            AdminBookDAL dalGenObj = new AdminBookDAL();
            genrelist = dalGenObj.BookGenreList();
            ViewBag.BookGenreList = genrelist;

            List<string> publisherlist = new List<string>();
            AdminBookDAL dalPubObj = new AdminBookDAL();
            publisherlist = dalPubObj.BookPublisherList();
            ViewBag.BookPublisherList = publisherlist;

            List<string> seriesList = new List<string>();
            AdminBookDAL dalSerList = new AdminBookDAL();
            seriesList = dalSerList.BookSeriesList();
            ViewBag.BookSeriesList = seriesList;
            return View();
        }
        public string AddBook(string BookGenre, string Name,string AuthorName,string Series,string Publisher,DateTime PublishDate,int NoOfCopies,int Cost)
        {
            if (ModelState.IsValid)
            {
                AdminBookDAL dalObj = new AdminBookDAL();
                AddBookViewModel bookObject = new AddBookViewModel();
                bookObject = dalObj.AddBook(BookGenre,Name,AuthorName,Series,Publisher,PublishDate,NoOfCopies,Cost);
                if (bookObject != null)
                {
                    if (bookObject.DataError== null)
                    {
                        ViewBag.message = "Book ID " + bookObject.BookId;
                    }
                    else
                    {
                        ViewBag.message = "-1";
                    }
                    return bookObject.BookId.ToString();
                }

            }
            return "false";
        }
 // GET: /AdminBook/AddBookGenre
 public ActionResult AddBookGenre()
 {
     if (Session["UserID"] != null)
     {
         if (Session["Role"].Equals("member"))
         {
             return RedirectToAction("Index", "Member");
         }
     }
     else
     {
         return RedirectToAction("Login", "Account");
     }
     List<string> list = new List<string>();
     AdminBookDAL dalObj = new AdminBookDAL();
     list = dalObj.BookGenreGroupList();
     ViewBag.BookGenreList = list;
     return View();
 }
 public ActionResult AddBookSeries(string SeriesName, string Author, string Genre, string Publisher, string BookName, int Copies, DateTime PublishDate, int Price)
 {
     if (ModelState.IsValid)
     {
         AdminBookDAL dalObj = new AdminBookDAL();
         if (dalObj.AddBookSeries(SeriesName,Author,Genre,Publisher,BookName,Copies,PublishDate,Price))
         {
             ViewBag.Message = "1";
             //return View();
             return Json(true, JsonRequestBehavior.AllowGet);
         }
         else
         {
             ViewBag.Message = "-1";
             //return View();
             return Json(false, JsonRequestBehavior.AllowGet);
         }
     }
     return View();
 }
        public ActionResult AddBookGenre(string BookGenreName, string BookGenreGroup,string BookNewGenreGroup)
        {
            if (ModelState.IsValid)
            {
                AdminBookDAL dalObj = new AdminBookDAL();

                if (BookGenreGroup == "NEW")
                {
                    if ((dalObj.AddGenreName(BookGenreName, BookNewGenreGroup)) && (dalObj.AddBookGenreGroup(BookNewGenreGroup)))
                    {
                        //code will be improvised
                        ViewBag.Message = "1";
                        //return View();
                        return Json(true, JsonRequestBehavior.AllowGet);
                    }
                    else
                    {
                        ViewBag.Message = "-1";
                        //return View();
                        return Json(false, JsonRequestBehavior.AllowGet);
                    }
                }
                else
                {
                    if (dalObj.AddGenreName(BookGenreName, BookNewGenreGroup))
                    {
                        //code will be improvised
                        ViewBag.Message = "1";
                        //return View();
                        return Json(true, JsonRequestBehavior.AllowGet);
                    }
                    else
                    {
                        ViewBag.Message = "-1";
                        //return View();
                        return Json(false, JsonRequestBehavior.AllowGet);
                    }
                }

            }
            return View();
        }