public IActionResult GetBooks() { var tableModel = new DataTablesAjaxRequestModel(Request); var model = new BooksModel(); var data = model.GetBooks(tableModel); return(Json(data)); }
public void LoadBooks() { AppBook[] appBooks = BooksModel.GetBooks().Select(b => new AppBook() { Id = b.Id.Value, Author = b.Author, Title = b.Title, Status = b.Status, EditBookCommand = new ActionCommand((o) => EditBook(b.Id.Value)), TakeBookCommand = new ActionCommand((o) => TakeBook(b.Id.Value)), ReturnBookCommand = new ActionCommand((o) => ReturnBook(b.Id.Value)), DeleteBookCommand = new ActionCommand((o) => DeleteBook(b.Id.Value)) }).ToArray(); BookStatuses = appBooks.ToDictionary(b => b.Id.Value, b => b.Status); Books.Clear(); foreach (AppBook appBook in appBooks) { Books.Add(appBook); } }