public ActionResult Del(string id) { DeleteVideoRequest resp = new DeleteVideoRequest(); resp.VideoIds = id; ViewBag.info = aliServer.DeleteVideo(resp); return(Redirect("/alivideo/index")); }
/// <summary> /// 删除视频 /// </summary> /// <param name="videoId"></param> public void DeleteVideo(string videoId) { var request = new DeleteVideoRequest(); request.VideoIds = videoId; request.RegionId = RegionId; Client.GetAcsResponse(request); }
public async Task <IActionResult> Delete(Guid id) { DeleteVideoRequest request = new DeleteVideoRequest() { Id = id }; await VideoService.DeleteVideoAsync(request); return(NoContent()); }
/// <summary> /// 删除视频 /// </summary> /// <param name="request"></param> /// <returns></returns> public DeleteVideoResponse DeleteVideo(DeleteVideoRequest request) { DeleteVideoResponse response = new DeleteVideoResponse(); try { response = acsClient.GetAcsResponse(request); } catch (Exception ex) { } return(response); }
public void TestDeleteVideoInvalidVideoId() { var videoCountBeforeInsert = _mockMediaStorageService.GetAllVideos().Result.Count; var invalidVideoId = "5"; var request = new DeleteVideoRequest { Id = invalidVideoId }; _mockMediaStorageService.DeleteVideo(request); var videoCountAfterInsert = _mockMediaStorageService.GetAllVideos().Result.Count; Assert.Equal(videoCountBeforeInsert, videoCountAfterInsert); }
public override IActionResult DeleteVideo(DeleteVideoRequest deleteVideoRequest) { var response = new EmptyObject { Success = true }; if (_mediaStorageService.DeleteVideo(deleteVideoRequest).Result) { return(StatusCode(200, response)); } response.Success = false; response.Message = "Video could not be deleted."; return(StatusCode(400, response)); }
public async Task <bool> DeleteVideo(DeleteVideoRequest request) { var videoFile = _storageManager.GetFile(request.Id + ".mp4", _containerName).Result; if (videoFile == null) { return(false); } var thumbnail = _storageManager.GetFile(request.Id + "-thumbnail.jpg", _containerName).Result; await videoFile.DeleteAsync(); await thumbnail.DeleteAsync(); return(true); }
public async Task <VideoResponse> DeleteVideoAsync(DeleteVideoRequest request) { if (request?.Id == null) { throw new ArgumentNullException(); } Video result = await _videoRepository.GetAsync(request.Id); result.IsInactive = true; _videoRepository.Update(result); int affected = await _videoRepository.UnitOfWork.SaveChangesAsync(); return(_mapper.Map <VideoResponse>(result)); }
private static Response DeleteVideoResponse(DeleteVideoRequest deleteVideoRequest) { DatabaseManager database = new DatabaseManager(); (MySqlDataReader reader, var Connection) = database.RunQuery($"DELETE FROM video_details WHERE videoid='{deleteVideoRequest.VideoID}'"); Acknowledge ack = new Acknowledge() { Status = "OK", Reason = "Video deleted successfully." }; Response resp = new Response() { Type = ResponseType.Acknowledge, Status = "OK", Content = ack }; if (reader == null) { ack.Reason = "Unable to delete video."; ack.Status = "FAIL"; Connection.Close(); return(resp); } else { Connection.Close(); (reader, Connection) = database.RunQuery($"UPDATE course_details SET videocount = videocount-1 WHERE courseid='{deleteVideoRequest.CourseID}'"); Connection.Close(); (reader, Connection) = database.RunQuery($"DELETE FROM comments WHERE videoid='{deleteVideoRequest.VideoID}'"); Connection.Close(); (reader, Connection) = database.RunQuery($"DELETE FROM tag_details WHERE videoid='{deleteVideoRequest.VideoID}'"); Connection.Close(); (reader, Connection) = database.RunQuery($"DELETE FROM favorites WHERE videoid='{deleteVideoRequest.VideoID}'"); Connection.Close(); if (File.Exists(serverroot + "/Thumbnails/" + deleteVideoRequest.VideoID + ".jpg")) { File.Delete(serverroot + "/Thumbnails/" + deleteVideoRequest.VideoID + ".jpg"); } if (File.Exists(serverroot + "/Videos/" + deleteVideoRequest.VideoID + ".mp4")) { File.Delete(serverroot + "/Videos/" + deleteVideoRequest.VideoID + ".mp4"); } } return(resp); }
public void TestDeleteVideoValidVideoId() { var allVids = _mockMediaStorageService.GetAllVideos().Result; var videoCountBeforeInsert = allVids.Count; if (allVids.Count == 0) { return; } var validVideoId = allVids[0].Id; var request = new DeleteVideoRequest { Id = validVideoId }; _mockMediaStorageService.DeleteVideo(request); var videoCountAfterInsert = _mockMediaStorageService.GetAllVideos().Result.Count; Assert.Equal(videoCountBeforeInsert, videoCountAfterInsert); }
/// <summary> /// 删除视频(可多个同时删除) /// </summary> /// <param name="videoIds">要删除的视频VideoID值 比如:"videoId1,videoId2"</param> public static void DeleteVideo(string videoIds) { try { // 构造请求 DeleteVideoRequest request = new DeleteVideoRequest(); request.VideoIds = videoIds; // 初始化客户端 //DefaultAcsClient client = InitVodClient(); // 发起请求,并得到 response DeleteVideoResponse response = client.GetAcsResponse(request); Console.WriteLine("RequestId = " + response.RequestId); } catch (ServerException ex) { Console.WriteLine(ex.ToString()); } catch (ClientException ex) { Console.WriteLine(ex.ToString()); } }
public abstract IActionResult DeleteVideo([FromBody] DeleteVideoRequest deleteVideoRequest);
private async void deleteVideoButton_Click(object sender, RoutedEventArgs e) { //enclose inside success. ConfirmWindow confirm = new ConfirmWindow(VideoTitle); confirm.ShowDialog(); if (confirm.Result && !IsFavoritesType) { DeleteVideoRequest request = new DeleteVideoRequest() { VideoID = VideoID, CourseID = CourseID }; Object result = await ConnectionManager.SendRequestAsync(request, RequestType.DeleteVideo, ResponseType.Acknowledge); if (result != null) { if (((JObject)result).ToObject <Acknowledge>().Status == "OK") { ((WrapPanel)Parent).Children.Remove(this); AppNotificationManager.PushMessage(new AppNotification() { Message = "Video Deleted Successfully." }); } } else { AppNotificationManager.PushMessage(new AppNotification() { Message = "Unable to delete video." }); } } else if (confirm.Result && IsFavoritesType) { DeleteFavorite request = new DeleteFavorite() { UserID = SettingsManager.Username, VideoID = VideoID }; Object result = await ConnectionManager.SendRequestAsync(request, RequestType.DeleteFavorite, ResponseType.Acknowledge); if (result != null) { if (((JObject)result).ToObject <Acknowledge>().Status == "OK") { ((WrapPanel)Parent).Children.Remove(this); AppNotificationManager.PushMessage(new AppNotification() { Message = "Favorite Deleted Successfully." }); } } else { AppNotificationManager.PushMessage(new AppNotification() { Message = "Unable to delete favorite." }); } } }
/// <summary> /// Удаляет видеозапись со страницы пользователя. /// </summary> /// <param name="callback">Метод, который будет вызван по завершении операции. /// Параметр является результатом запроса.</param> /// <param name="request">Объект запроса с необходимыми параметрами.</param> public void Delete(Action <VKResponse <VKOperationIsSuccess> > callback, DeleteVideoRequest request) { VKHelper.GetResponse <VKOperationIsSuccess>(request, callback); }