Work on the requests page mostly done.

This commit is contained in:
tidusjar 2016-03-01 14:39:55 +00:00
parent 70362b908f
commit 98d143c9b2
17 changed files with 297 additions and 78 deletions

View file

@ -24,10 +24,12 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using System.Linq;
using Mono.Data.Sqlite;
using RequestPlex.Api;
using RequestPlex.Store;
namespace RequestPlex.Core
@ -47,12 +49,38 @@ namespace RequestPlex.Core
public void AddRequest(int tmdbid, RequestType type)
{
var model = new RequestedModel
var api = new TheMovieDbApi();
var model = new RequestedModel();
if (type == RequestType.Movie)
{
Tmdbid = tmdbid,
Type = type
};
var movieInfo = api.GetMovieInformation(tmdbid).Result;
model = new RequestedModel
{
Tmdbid = tmdbid,
Type = type,
Overview = movieInfo.Overview,
ImdbId = movieInfo.ImdbId,
PosterPath = "http://image.tmdb.org/t/p/w150/" + movieInfo.PosterPath,
Title = movieInfo.Title,
ReleaseDate = movieInfo.ReleaseDate ?? DateTime.MinValue
};
}
else
{
var showInfo = api.GetTvShowInformation(tmdbid).Result;
model = new RequestedModel
{
Tmdbid = tmdbid,
Type = type,
Overview = showInfo.Overview,
//ImdbId = showInfo.ImdbId, //TODO where's the IMDBId?
PosterPath = "http://image.tmdb.org/t/p/w150/" + showInfo.PosterPath,
Title = showInfo.Name,
ReleaseDate = showInfo.FirstAirDate ?? DateTime.MinValue
};
}
var db = new DbConfiguration(new SqliteFactory());
var repo = new GenericRepository<RequestedModel>(db);