|
1 | 1 | using System;
|
2 |
| -using System.Collections.Generic; |
3 |
| -using TMDbLib.Objects.General; |
| 2 | +using TMDbLib.Utilities; |
4 | 3 |
|
5 | 4 | namespace TMDbLib.Objects.Search
|
6 | 5 | {
|
7 | 6 | public class SearchMulti
|
8 | 7 | {
|
9 | 8 | public int Id { get; set; }
|
10 |
| - public string Title { set { Name = value; } } |
| 9 | + |
| 10 | + public string Title { set { Name = value; } get { return Name; } } |
11 | 11 | public string Name { get; set; }
|
12 |
| - public string OriginalName { get; set; } |
13 |
| - public string OriginalTitle { set { OriginalName = value; } } |
14 |
| - public DateTime? FirstAirDate { get; set; } |
15 |
| - public string BackdropPath { get; set; } |
| 12 | + |
| 13 | + public string BackdropPath { set { PosterPath = value; } get { return PosterPath; } } |
16 | 14 | public string PosterPath { get; set; }
|
| 15 | + |
| 16 | + public SearchMediaType Type { get; set; } |
17 | 17 | public double Popularity { get; set; }
|
18 |
| - public double VoteAverage { get; set; } |
19 |
| - public int VoteCount { get; set; } |
20 |
| - public bool Adult { get; set; } |
21 |
| - public DateTime? ReleaseDate { get; set; } |
22 |
| - public MediaType Type { get; set; } |
23 |
| - public List<string> OriginCountry { get; set; } |
| 18 | + |
| 19 | + public SearchTv AsTvShow { get; set; } |
| 20 | + public SearchMovie AsMovie { get; set; } |
| 21 | + public SearchPerson AsPerson { get; set; } |
| 22 | + |
| 23 | + // Individual fields not found in all three Media Types |
| 24 | + //public string OriginalName { get; set; } |
| 25 | + //public string OriginalTitle { set { OriginalName = value; } } |
| 26 | + //public DateTime? FirstAirDate { get; set; } |
| 27 | + //public double VoteAverage { get; set; } |
| 28 | + //public int VoteCount { get; set; } |
| 29 | + //public bool Adult { get; set; } |
| 30 | + //public DateTime? ReleaseDate { get; set; } |
| 31 | + //public List<string> OriginCountry { get; set; } |
24 | 32 |
|
25 | 33 | public string MediaType
|
26 | 34 | {
|
27 | 35 | set
|
28 | 36 | {
|
29 |
| - switch (value) |
30 |
| - { |
31 |
| - case "tv": |
32 |
| - Type = General.MediaType.TVShow; |
33 |
| - break; |
34 |
| - case "movie": |
35 |
| - Type = General.MediaType.Movie; |
36 |
| - break; |
37 |
| - default: |
38 |
| - Type = General.MediaType.Unknown; |
39 |
| - break; |
40 |
| - } |
| 37 | + if (SearchMediaType.Movie.GetDescription().Equals(value, StringComparison.InvariantCultureIgnoreCase)) |
| 38 | + Type = SearchMediaType.Movie; |
| 39 | + else if (SearchMediaType.TVShow.GetDescription().Equals(value, StringComparison.InvariantCultureIgnoreCase)) |
| 40 | + Type = SearchMediaType.TVShow; |
| 41 | + else if (SearchMediaType.Person.GetDescription().Equals(value, StringComparison.InvariantCultureIgnoreCase)) |
| 42 | + Type = SearchMediaType.Person; |
| 43 | + else |
| 44 | + Type = SearchMediaType.Unknown; |
41 | 45 | }
|
42 | 46 | }
|
43 | 47 | }
|
|
0 commit comments