public MainViewModel() { InitializeCollections(); AddVideo = new RelayCommand(AddVideoExecute); AddCategory = new RelayCommand(AddCategoryExecute); RefreshCommand = new RelayCommand(RefreshAll); NewVideo = new VideoViewModel(); NewCategory = new CategoryViewModel(); }
private async void AddVideoExecute() { if (NewVideo != null) { var video = new FiveMinVideo { Name = NewVideo.Name, Categories = new List<string> { SelectedCategory.Name }, Description = NewVideo.Description, ImageUrl = NewVideo.BackdropUrl, DateAdded = DateTime.Now, Likes = 0, Dislikes = 0, WatchCount = 0, IsWatched = false, VideoId = NewVideo.VideoUrl, Keywords = NewVideo.KeywordsFormatted, Length = NewVideo.LengthFormatted }; await FirebaseManager.Instance.AddVideo(video); Videos.Add(video); NewVideo = new VideoViewModel(); } }