예제 #1
0
 public Book ReadBook(int id)
 {
     if (id <= 0)
     {
         return(new Book());
     }
     return(BookMethod.Read(id));
 }
예제 #2
0
        public IActionResult SeeBook(int id)
        {
            BookDetail bd = new BookDetail();
            BookMethod bm = new BookMethod();

            bd            = bm.GetBook(id, out string error);
            ViewBag.error = error;
            return(View(bd));
        }
예제 #3
0
        public IActionResult OrderBooks(string Order)
        {
            List <BookDetail> Booklist = new List <BookDetail>();
            BookMethod        bm       = new BookMethod();

            Booklist      = bm.GetBooks(out string error, Order);
            ViewBag.error = error;
            return(View("Booklist", Booklist));
        }
예제 #4
0
        public IActionResult Booklist()
        {
            List <BookDetail> Booklist = new List <BookDetail>();
            BookMethod        bm       = new BookMethod();

            Booklist      = bm.GetBooks(out string error, "");
            ViewBag.error = error;
            return(View(Booklist));
        }
예제 #5
0
        public IActionResult SearchedList(string s)
        {
            ViewBag.s = s;
            List <BookDetail> Booklist = new List <BookDetail>();
            BookMethod        bm       = new BookMethod();

            Booklist      = bm.GetBooksBySearch(s, out string error);
            ViewBag.error = error;
            return(View(Booklist));
        }
예제 #6
0
        public IActionResult Booklist(string Titel)
        {
            int i = Convert.ToInt32(Titel);
            List <BookDetail> Booklist = new List <BookDetail>();
            BookMethod        bm       = new BookMethod();

            Booklist      = bm.FilterBooks(out string error, i);
            ViewBag.error = error;
            return(View(Booklist));
        }
예제 #7
0
        public IActionResult DeleteBook(int id)
        {
            BookMethod bm = new BookMethod();
            int        i  = 0;

            i             = bm.DeleteBook(id, out string error);
            ViewBag.error = error;
            ViewBag.antal = i;
            return(RedirectToAction("Booklist"));
        }
예제 #8
0
        public List <Book> FindBook(string searchInput)
        {
            bool isValid = !IsStringEmpty(searchInput);

            if (!isValid)
            {
                return(new List <Book>());
            }
            return(BookMethod.Find(searchInput));
        }
예제 #9
0
        public bool UpdateBook(int id, string title, string author, string publisher, DateTime published)
        {
            bool isValid = !IsStringEmpty(title) && id > 0 && account.AccountLevel >= AccountLevelEnums.Librarian;

            if (!isValid)
            {
                return(false);
            }
            BookMethod.Update(new Book(id, title, author, publisher, published));
            return(true);
        }
예제 #10
0
        public bool RemoveBook(int id)
        {
            bool isValid = account.AccountLevel >= AccountLevelEnums.Librarian && id > 0;

            if (!isValid)
            {
                return(false);
            }
            BookMethod.Remove(id);
            return(true);
        }
예제 #11
0
        public IActionResult NewBook(BookDetail bd)
        {
            UserMethod um          = new UserMethod();
            string     usr         = HttpContext.Session.GetString("currentuser");
            UserDetail currentUser = JsonConvert.DeserializeObject <UserDetail>(usr);
            int        id          = currentUser.Id;
            BookMethod bm          = new BookMethod();
            int        i           = 0;
            string     error       = "";

            i             = bm.NewBook(bd, id, out error);
            ViewBag.error = error;
            ViewBag.antal = i;
            return(View());
        }
예제 #12
0
        public IActionResult EditBook(int id, BookDetail bd)
        {
            BookMethod bm    = new BookMethod();
            int        i     = 0;
            string     error = "";

            bd.Id         = id;
            i             = bm.EditBook(bd, out error);
            ViewBag.error = error;
            if (i == 1)
            {
                return(RedirectToAction("Booklist"));
            }
            else
            {
                return(View());
            }
        }
예제 #13
0
        public ActionResult Book(int id)
        {
            var model = BookMethod.GetBook(id);

            return(View(model));
        }
예제 #14
0
 public List <Book> ReadBook()
 {
     return(BookMethod.Read());
 }