コード例 #1
0
        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"
            });
        }
コード例 #2
0
 public void RemoveFromFavorites(FavoritesRequest request)
 {
     movieRepository.RemoveFavorite(request.MovieId);
 }
コード例 #3
0
 public void AddToFavorites(FavoritesRequest request)
 {
     movieRepository.AddFavorite(request.MovieId);
 }
コード例 #4
0
 public IActionResult RemoveFromFavorites([FromBody] FavoritesRequest request)
 {
     movieService.RemoveFromFavorites(request);
     return(Ok());
 }
コード例 #5
0
 public IActionResult AddToFavorites([FromBody] FavoritesRequest request)
 {
     movieService.AddToFavorites(request);
     return(Ok());
 }
コード例 #6
0
        public string getFavoritesRequest(UserNameProp userNameProp)
        {
            FavoritesRequest favoritesRequest = new FavoritesRequest(userNameProp);

            return(objToJson <FavoritesRequest>(favoritesRequest));
        }