public IActionResult Songs(string filter = null) { ListSongViewModel model = new ListSongViewModel(); model.songs = _mapper.Map <List <SongModel> >(_songService.GetAllSongs()); return(View(model)); }
public ActionResult PerformerProfile(int?idPerformer, int page = 1, string sort = "") { IEnumerable <SongViewModel> songsPerPage; PerformerDTO performDto = PerformerServices.GetById(idPerformer); performDto.Songs = SongServices.Sort(sort, performDto.Songs); var performer = _mapper.Map <PerformerViewModel>(performDto); songsPerPage = performer.Songs.Skip((page - 1) * pageSize).Take(pageSize); PageInfo pageInfo = new PageInfo { PageNumber = page, PageSize = pageSize, TotalItems = performer.Songs.Count() }; ListSongViewModel model = new ListSongViewModel { PageInfo = pageInfo, Songs = songsPerPage, Performer = performer, CurrentSort = sort }; return(View(model)); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); View view = this.BindingInflate(Resource.Layout.ListSong, null); var prefs = Application.Context.GetSharedPreferences("Fildo", FileCreationMode.Private); this.cultureInfo = ((MainView)this.Activity).CultureInfo; if (!string.IsNullOrEmpty(((BaseViewModel)((MainView)this.Activity).ViewModel).PlayingArtist)) { ((MainView)this.Activity).FindViewById <Android.Widget.LinearLayout>(Resource.Id.miniPlayer).Visibility = ViewStates.Visible; } //AndroidEnvironment.UnhandledExceptionRaiser -= HandleAndroidException; //AndroidEnvironment.UnhandledExceptionRaiser += HandleAndroidException; TabLayout tabs = view.FindViewById <TabLayout>(Resource.Id.tabs); if (this.ViewModel != null) { ((BaseViewModel)((MainView)this.Activity).ViewModel).PicUrl = ((ListSongViewModel)this.ViewModel).PicUrl; string image = ((ListSongViewModel)this.ViewModel).PicUrl; ((MainView)this.Activity).FindViewById <MvxImageView>(Resource.Id.artistImageTest).ImageUrl = image; ListSongViewModel listSongViewModel = (ListSongViewModel)this.ViewModel; if (listSongViewModel.IsArtist) { tabs.Visibility = ViewStates.Visible; tabs.AddTab(tabs.NewTab().SetText("SONGS")); tabs.AddTab(tabs.NewTab().SetText("ALBUMS")); tabs.AddTab(tabs.NewTab().SetText("SIMILAR")); tabs.TabSelected += this.Tabs_TabSelected; } else { tabs.Visibility = ViewStates.Gone; } } AppBarLayout appBarLayout = ((MainView)this.Activity).FindViewById <AppBarLayout>(Resource.Id.appbar); CollapsingToolbarLayout collapsingToolbarLayout = ((MainView)this.Activity).FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar); float density = this.Resources.DisplayMetrics.Density; float heightDp = 200 * density; CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams)appBarLayout.LayoutParameters; lp.Height = (int)heightDp; appBarLayout.SetExpanded(true); //this.fab = FindViewById<FloatingActionButton>(Resource.Id.fab); //var collapsibleToolbar = FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar); this.SetHasOptionsMenu(true); this.progress = new Bindables.BindableProgress(view.Context, this.ViewModel); var set = this.CreateBindingSet <ListSongView, ListSongViewModel>(); set.Bind(this.progress).For(p => p.Visible).To(vm => vm.IsBusy); set.Bind(collapsingToolbarLayout).For(p => p.Title).To(vm => vm.TitleView); //set.Bind(collapsibleToolbar).For(p => p.Title).To(vm => vm.TitleView); set.Apply(); this.songList = view.FindViewById <MvxRecyclerView>(Resource.Id.SongList); this.albumList = view.FindViewById <MvxRecyclerView>(Resource.Id.AlbumList); this.similarList = view.FindViewById <MvxRecyclerView>(Resource.Id.SimilarList); this.similarList.Visibility = ViewStates.Gone; this.albumList.Visibility = ViewStates.Gone; DisplayMetrics displayMetrics = this.Resources.DisplayMetrics; float dpWidth = displayMetrics.WidthPixels / displayMetrics.Density; var columnFloat = dpWidth / 160; GridLayoutManager lLayout = new GridLayoutManager(view.Context, (int)Math.Truncate(columnFloat)); GridLayoutManager lLayout2 = new GridLayoutManager(view.Context, (int)Math.Truncate(columnFloat)); this.albumList.HasFixedSize = true; this.albumList.SetLayoutManager(lLayout); this.similarList.HasFixedSize = true; this.similarList.SetLayoutManager(lLayout2); GAService.GetGASInstance().Track_App_Page("List Songs"); return(view); }