public Book ReadBook(int id) { if (id <= 0) { return(new Book()); } return(BookMethod.Read(id)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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")); }
public List <Book> FindBook(string searchInput) { bool isValid = !IsStringEmpty(searchInput); if (!isValid) { return(new List <Book>()); } return(BookMethod.Find(searchInput)); }
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); }
public bool RemoveBook(int id) { bool isValid = account.AccountLevel >= AccountLevelEnums.Librarian && id > 0; if (!isValid) { return(false); } BookMethod.Remove(id); return(true); }
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()); }
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()); } }
public ActionResult Book(int id) { var model = BookMethod.GetBook(id); return(View(model)); }
public List <Book> ReadBook() { return(BookMethod.Read()); }