public IActionResult RemoveVideoFromTopic([FromBody] RmoveTopicFromVideoData data) { try { var userData = jwtService.ParseData(this.User); this.topicService.RemoveTopicFromVideo(data, userData.UserId); return(Ok()); } catch (ServiceException e) { return(BadRequest(e.Message)); } }
public void RemoveTopicFromVideo(RmoveTopicFromVideoData data, int userId) { var topicId = data.TopicId; var videoId = data.VideoId; var connection = this.context.VideosTopics .SingleOrDefault(x => x.TopicId == topicId && x.VideoId == videoId); if (connection != null) { this.context.VideosTopics.Remove(connection); this.context.SaveChanges(); } }