public ActionResult Index(int page = 1) { var collections = uow.BookCollectionRepository.Get( filter: c => c.Name.Contains(""), orderBy: q => q.OrderBy(c => c.Name)) .ToList(); if (collections == null) { return(RedirectToAction("Index")); } var collectionViewModelList = new List <BookCollectionViewModel>(); foreach (var collection in collections) { var bookCollectionViewModel = new BookCollectionViewModel(collection); collectionViewModelList.Add(bookCollectionViewModel); } var collectionViewModelPagedList = collectionViewModelList.ToPagedList(page, 10); if (Request.IsAjaxRequest()) { return(PartialView("_CollectionList", collectionViewModelPagedList)); } return(View(collectionViewModelPagedList)); }
public BookListSimplePage() { InitializeComponent(); _viewModel = new BookCollectionViewModel(); BindingContext = _viewModel; finishButton.Clicked += async(s, e) => await Navigation.PopModalAsync(); }
public async Task <ActionResult> CreateNewBooklist(BookCollectionViewModel model) { var newBooklist = new Booklists { booklistName = model.Name }; var booklist = db.Booklists.Add(newBooklist); var newLink = new linkAspNetUsersBooklists { aspNetUserId = UserId, booklistId = booklist.booklistId }; db.linkAspNetUsersBooklists.Add(newLink); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public MainWindowViewModel() { /* * create book collection and add three example books */ BookCollection MyBookCollection = new BookCollection(); MyBookCollection.Add(new Book()); MyBookCollection.ElementAt <Book>(0).Author = "Lars Raschke"; MyBookCollection.ElementAt <Book>(0).Title = "How to program last minute"; MyBookCollection.ElementAt <Book>(0).Edition = 1; MyBookCollection.ElementAt <Book>(0).PubYear = 2018; MyBookCollection.ElementAt <Book>(0).Available = true; MyBookCollection.Add(new Book()); MyBookCollection.ElementAt <Book>(1).Author = "Dieter Bohlen"; MyBookCollection.ElementAt <Book>(1).Title = "Weg zum Erfolg"; MyBookCollection.ElementAt <Book>(1).Edition = 3; MyBookCollection.ElementAt <Book>(1).PubYear = 1995; MyBookCollection.ElementAt <Book>(1).Available = false; MyBookCollection.Add(new Book()); MyBookCollection.ElementAt <Book>(2).Author = "Beate Uhse"; MyBookCollection.ElementAt <Book>(2).Title = "Gummibaum statt Gummifrauen"; MyBookCollection.ElementAt <Book>(2).Edition = 2; MyBookCollection.ElementAt <Book>(2).PubYear = 2010; MyBookCollection.ElementAt <Book>(2).Available = true; // create a wrapped book collection of the book collection MyWrappedBookCollection = new BookCollectionViewModel(MyBookCollection); // creating RelayCommands with the given methods openFileDialogCommand = new RelayCommand(OpenNewFileDialog); exitApplicationCommand = new RelayCommand(ExitCurrentApplication); addNewBookCommand = new RelayCommand(() => Messenger.Instance.Send <OpenNewBookWindowMessage>(new OpenNewBookWindowMessage())); }