private static Response FavoriteVideosResponse(FavoritesRequest favoritesRequest) { DatabaseManager database = new DatabaseManager(); (MySqlDataReader reader, var Connection) = database.RunQuery($"SELECT duration, thumbnail, title, videoid FROM video_details WHERE videoid IN ( SELECT videoid FROM favorites WHERE userid='{favoritesRequest.Userid}')"); if (reader != null) { Data.EditCourseVideosResponse res = new Data.EditCourseVideosResponse(); res.videoList = new List <VideoMini>(); while (reader.Read()) { res.videoList.Add(new VideoMini() { Duration = reader.GetString(0), Thumbnail = reader.GetString(1), Title = reader.GetString(2), VideoId = reader.GetString(3) }); } Connection.Close(); return(new Response() { Type = ResponseType.Favorites, Content = res, Status = "OK" }); } Connection.Close(); return(new Response() { Content = null, Type = ResponseType.Favorites, Status = "FAIL" }); }
public void RemoveFromFavorites(FavoritesRequest request) { movieRepository.RemoveFavorite(request.MovieId); }
public void AddToFavorites(FavoritesRequest request) { movieRepository.AddFavorite(request.MovieId); }
public IActionResult RemoveFromFavorites([FromBody] FavoritesRequest request) { movieService.RemoveFromFavorites(request); return(Ok()); }
public IActionResult AddToFavorites([FromBody] FavoritesRequest request) { movieService.AddToFavorites(request); return(Ok()); }
public string getFavoritesRequest(UserNameProp userNameProp) { FavoritesRequest favoritesRequest = new FavoritesRequest(userNameProp); return(objToJson <FavoritesRequest>(favoritesRequest)); }