public ActionResult UpdateMessage([FromBody] VideoUpdateRequest request) { //call videoService to update the values into postgresql database videoService.updateMessage(request.id, request.VidType, request.Bname, request.BoardID, request.Message); // update message video for certain event //call createvsn to create the vsn file _createVsnService.createVSN(request.id, false); return(Ok()); }
public void Update(VideoUpdateRequest model) { string procName = "[dbo].[Video_Update]"; _data.ExecuteNonQuery(procName, inputParamMapper : delegate(SqlParameterCollection col) { AddCommonParams(model, col); col.AddWithValue("@Id", model.Id); }, returnParameters: null); }
[Route, HttpPut] // PUT: api/video public HttpResponseMessage Update(VideoUpdateRequest model) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } else { SuccessResponse resp = new SuccessResponse(); VideoService.Update(model); return(Request.CreateResponse(HttpStatusCode.OK, resp)); } }
public static void Update(VideoUpdateRequest v) { DataProvider.Instance.ExecuteNonQuery( GetConnection , "dbo.Video_Update" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Id", v.Id); paramCollection.AddWithValue("@Title", v.Title); paramCollection.AddWithValue("@Description", v.Description); paramCollection.AddWithValue("@Url", v.Url); } , returnParameters: null ); return; }
public ActionResult <SuccessResponse> Update(VideoUpdateRequest model) { int code = 200; BaseResponse response = null; try { _service.Update(model); response = new SuccessResponse(); } catch (Exception ex) { code = 500; response = new ErrorResponse(ex.Message); } return(StatusCode(code, response)); }
private static Response UpdateVideoResponse(VideoUpdateRequest videoUpdateRequest) { DatabaseManager database = new DatabaseManager(); (MySqlDataReader reader, var Connection) = database.RunQuery($"UPDATE video_details SET title='{RefineContent(videoUpdateRequest.Title)}', description='{RefineContent(videoUpdateRequest.Description)}' WHERE videoid='{videoUpdateRequest.VideoID}'"); if (reader != null) { VideoUpdateResponse res = new VideoUpdateResponse() { IsThumbnailUpdateRequired = videoUpdateRequest.IsThumbnailUpdateRequired, ThumbnailImage = videoUpdateRequest.VideoID, Reason = "Video Updated Successfully", Status = "OK" }; if (videoUpdateRequest.Tags.Count >= 1) { database.RunQuery($"DELETE FROM tag_details WHERE videoid='{videoUpdateRequest.VideoID}'"); StringBuilder str = new StringBuilder($"INSERT INTO tag_details (tag, videoid) VALUES ('{RefineContent(videoUpdateRequest.Tags[0])}', '{videoUpdateRequest.VideoID}')"); for (int i = 1; i < videoUpdateRequest.Tags.Count; i++) { str.Append($", ('{videoUpdateRequest.Tags[i]}', '{videoUpdateRequest.VideoID}')"); } database.RunQuery(str.ToString()); } Connection.Close(); return(new Response() { Type = ResponseType.VideoUpdate, Content = res, Status = "OK" }); } Connection.Close(); return(new Response() { Content = null, Type = ResponseType.VideoUpdate, Status = "FAIL" }); }
private async void uploadVideoButton_Click(object sender, RoutedEventArgs e) { if (IsValid() && !IsEditVideoType) { progressRing.isActive = true; CreateVideoRequest request = new CreateVideoRequest() { AuthorId = SettingsManager.Username, AuthorName = SettingsManager.FullName, CourseId = CourseID.CourseID, CourseName = CourseID.CourseName, Decription = descriptionTextBlock.Text, Duration = duration, Height = videoHeight, Width = videoWidth, Title = titleTextBlock.Text, Tags = new List <string>() }; foreach (Tags tag in tagsContainer.Children) { request.Tags.Add(tag.TagName); } Object resp = await ConnectionManager.SendRequestAsync(request, RequestType.CreateVideo, ResponseType.CreateVideo); if (resp != null) { CreateVideoResponse response = ((JObject)resp).ToObject <CreateVideoResponse>(); string path = Guid.NewGuid().ToString() + ".jpg"; File.Copy(thumbnailPath, path); Object response2 = await ConnectionManager.SendVideoFileAsync(chosenVideoPathTextBlock.Text, path, response.Port); if (File.Exists(path)) { File.Delete(path); } if (response2 != null) { AppNotificationManager.PushMessage(new AppNotification() { Message = ((JObject)response2).ToObject <Acknowledge>().Reason }); } else { AppNotificationManager.PushMessage(new AppNotification() { Message = "Video Upload Failed Failed." }); } Close(); } else { errorTextBlock.Text = "Connection Error"; } progressRing.isActive = false; } else if (IsValid() && IsEditVideoType) { progressRing.isActive = true; VideoUpdateRequest request = new VideoUpdateRequest() { Title = titleTextBlock.Text, Description = descriptionTextBlock.Text, IsThumbnailUpdateRequired = thumbnailChosen, Tags = new List <string>() }; foreach (Tags tags in ((WrapPanel)tagsContainer).Children) { request.Tags.Add(tags.TagName); } Object resp = await ConnectionManager.SendRequestAsync(request, RequestType.VideoUpdate, ResponseType.Acknowledge); if (resp != null) { VideoUpdateResponse ack = ((JObject)resp).ToObject <VideoUpdateResponse>(); if (ack.Status == "OK") { try { if (thumbnailChosen) { await ConnectionManager.SendFileAsync(thumbnailPath, null); } }catch (Exception ex) { AppNotificationManager.PushMessage(new AppNotification() { Message = ex.Message }); Close(); } } errorTextBlock.Text = ack.Reason; } else { errorTextBlock.Text = "Connection Error."; } } }
private async void modifyVideoButton_Click(object sender, RoutedEventArgs e) { progressRing.isActive = true; VideoUpdateRequest request = new VideoUpdateRequest() { VideoID = VideoID, Title = titleTextBlock.Text, Description = descriptionTextBlock.Text, IsThumbnailUpdateRequired = thumbnailChosen, Tags = new List <string>() }; foreach (Tags tags in ((WrapPanel)tagsContainer).Children) { request.Tags.Add(tags.TagName); } Object resp = await ConnectionManager.SendRequestAsync(request, RequestType.VideoUpdate, ResponseType.VideoUpdate); if (resp != null) { VideoUpdateResponse ack = ((JObject)resp).ToObject <VideoUpdateResponse>(); if (ack.Status == "OK") { if (thumbnailChosen) { string tempPath = "Temporary/" + Guid.NewGuid() + ".jpg"; if (Directory.Exists("Temporary/")) { Directory.CreateDirectory("Temporary/"); } File.Copy(thumbnailPath, tempPath); var result = await ConnectionManager.SendFileAsync(tempPath, null); if (result != null) { var response = ((JObject)result).ToObject <Acknowledge>(); errorTextBlock.Text = response.Reason; if (response.Status == "OK") { AppNotificationManager.PushMessage(new AppNotification() { Message = response.Reason }); Close(); } } if (File.Exists(tempPath)) { File.Delete(tempPath); } } AppNotificationManager.PushMessage(new AppNotification() { Message = ack.Reason }); Close(); } errorTextBlock.Text = ack.Reason; } else { errorTextBlock.Text = "Connection Error."; } }