Murilo Barbosa
Murilo Barbosa
CC#
Created by Murilo Barbosa on 11/28/2023 in #help
How to Dynamically add item to List?
I have an app that shows movies, I want to click a link in front of the movie image(plus sign) that will display a dropdown containing the lists the user has created. The user will then select which list he/she wants the movie added to. All without changing views. After adding some movies the user would be able to go to the movie lists view and select any list to check the movies added. I can already create the empty lists, but I have no Idea of where to begin adding the movies. Probably an action would do the Job, but I need some direction.
17 replies
CC#
Created by Murilo Barbosa on 11/18/2023 in #help
Can't access object attributes using X.PagedList
I have a search field that returns a list of movies. It works fine if I reference the model as @MovieSearch in the View. But I want to use pagination so it won't break with thousands of results if someone types "a". I'm trying to use X.PagedList, but when I use IPagedList<MovieSearch> as model I can't access the MovieSearchResults[] results property inside MovieSearch in the View, and that contains most of the data I want to retrieve from the search. Basically I can't access anything inside "results" below. public class MovieSearch { public int? page { get; set; } public MovieSearchResult[]? results { get; set; } public int? total_pages { get; set; } public int total_results { get; set; } } public class MovieSearchResult { public string? backdrop_path { get; set; } public string? first_air_date { get; set; } public int[]? genre_ids { get; set; } public int? id { get; set; } public string? title { get; set; } public string[]? origin_country { get; set; } public string? original_language { get; set; } public string? original_title { get; set; } public string? overview { get; set; } public float? popularity { get; set; } public string? poster_path { get; set; } public float? vote_average { get; set; } public int? vote_count { get; set; } } The search results come as objects from a SearchMovies method, I'm not accessing any local DB. This model comes from the API. Any ideas?
10 replies
CC#
Created by Murilo Barbosa on 11/16/2023 in #help
NullReference from API JSON
Hello, I'm trying to retrieve some data from TMDB API, but there's this attribute that is named "watch/providers" in the JSON, and in my Model I can't name it like this because of the "/", so my method returns null for this specific data because it won't match the JSON. Is there anyway to retrieve this data having the Model attribute with a different name from the JSON?
8 replies
CC#
Created by Murilo Barbosa on 11/11/2023 in #help
NullReference Exception
Hello, I have this application that retrieves data from the TMDB API, but when I click on Details to be redirected to the Details View, it is returning a NullReference Exception at the TMDBMappingService. The exception is thrown when I try to get the iso_3166_1 value at the GetRating method. I checked and the value is indeed null after the app fetches the Movie data. I'm trying to figure out what's happening but so far I haven't been lucky. I appreciate any help. Repo: https://github.com/murilodab/Cinemanage/blob/main/Services/TMDBMappingService.cs The exception is thrown at line 126.
11 replies