public HomeViewModel(ApplicationViewModel applicationViewModel, IResponseDataProvider dataProvider) : base(applicationViewModel, dataProvider) { }
protected override void InitializeCommands() { base.InitializeCommands(); Delete = new RelayCommand(o => { ApplicationViewModel.RestClient.ExecuteAsync(ApplicationViewModel.RequestFactory.DeleteAlbumRequest(model.Id), (r, c) => { if (r.Succeeded()) { ApplicationViewModel.DisplayView.Execute(model.Artist); ApplicationViewModel.ClearHistory(); } else { ApplicationViewModel.HandlExceptionResponse(r.ExceptionResponse()); } }); /*Response<bool> response = DataProvider.DeleteAlbum(model.Id); * if (!response.Status) ApplicationViewModel.HandleError(response.Error); * else * { * ApplicationViewModel.DisplayView.Execute(model.Artist); * ApplicationViewModel.ClearHistory(); * }*/ }); CreateSong = new RelayCommand(o => { ApplicationViewModel.CreateView.Execute(new CreateSongViewModel(ApplicationViewModel, DataProvider, model)); }); NextCommentPage = new RelayCommand(o => RefreshComments(Model.Id, CommentPage.PageNumber + 1)); PreviousCommentPage = new RelayCommand(o => RefreshComments(Model.Id, CommentPage.PageNumber - 1)); PostComment = new RelayCommand(o => { Comment comment = new Comment() { EntityType = EntityType.ALBUM, User = LoginSession.Authentication.User, EntityId = Model.Id, Content = CommentContent }; RestClient.ExecuteAsync <Comment>(RequestFactory.AddCommentRequest(comment), (resp, handle) => { if (resp.Succeeded()) { RefreshComments(Model.Id, 1); } else { ApplicationViewModel.HandlExceptionResponse(resp.ExceptionResponse()); } }); }); AdminDeleteComment = new RelayCommand(o => { if (!(o is Comment)) { return; } Comment comment = o as Comment; RestClient.ExecuteAsync(RequestFactory.DeleteCommentRequest(comment.Id), (resp, handle) => { if (resp.Succeeded()) { RefreshComments(Model.Id, CommentPage.PageNumber); } else { ApplicationViewModel.HandlExceptionResponse(resp.ExceptionResponse()); } }); }); }
public ChildViewModel(ApplicationViewModel applicationViewModel, IResponseDataProvider dataProvider) { ApplicationViewModel = applicationViewModel; DataProvider = dataProvider; SearchText = ""; }
public SongViewModel(ApplicationViewModel applicationViewModel, IResponseDataProvider dataProvider) : base(applicationViewModel, dataProvider) { model = new Song(); }