initial load
This commit is contained in:
39
YouTubeViewers.WPF/Commands/DeleteYouTubeViewerCommand.cs
Normal file
39
YouTubeViewers.WPF/Commands/DeleteYouTubeViewerCommand.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YouTubeViewers.Domain.Models;
|
||||
using YouTubeViewers.WPF.Stores;
|
||||
using YouTubeViewers.WPF.ViewModels;
|
||||
|
||||
namespace YouTubeViewers.WPF.Commands
|
||||
{
|
||||
public class DeleteYouTubeViewerCommand : AsyncCommandBase
|
||||
{
|
||||
private readonly YouTubeViewersListingItemViewModel _youTubeViewersListingItemViewModel;
|
||||
private readonly YouTubeViewersStore _youTubeViewersStore;
|
||||
|
||||
public DeleteYouTubeViewerCommand(
|
||||
YouTubeViewersListingItemViewModel youTubeViewersListingItemViewModel,
|
||||
YouTubeViewersStore youTubeViewersStore)
|
||||
{
|
||||
_youTubeViewersListingItemViewModel = youTubeViewersListingItemViewModel;
|
||||
_youTubeViewersStore = youTubeViewersStore;
|
||||
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
YouTubeViewer youTubeViewer = _youTubeViewersListingItemViewModel.YouTubeViewer;
|
||||
try
|
||||
{
|
||||
await _youTubeViewersStore.Delete(youTubeViewer.Id);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user