Some more work. Need to stop the form submitting on a request

This commit is contained in:
tidusjar 2016-02-26 17:29:20 +00:00
parent 9a78f790a6
commit 96a3970a53
7 changed files with 106 additions and 8 deletions

View file

@ -38,5 +38,36 @@ namespace RequestPlex.Core
return settings;
}
public void AddRequest(int tmdbid, RequestType type)
{
var model = new RequestedModel
{
Tmdbid = tmdbid,
Type = type
};
var db = new DbConfiguration(new SqliteFactory());
var repo = new GenericRepository<RequestedModel>(db);
repo.Insert(model);
}
public bool CheckRequest(int tmdbid)
{
var db = new DbConfiguration(new SqliteFactory());
var repo = new GenericRepository<RequestedModel>(db);
return repo.GetAll().Any(x => x.Tmdbid == tmdbid);
}
public void DeleteRequest(int tmdbId)
{
var db = new DbConfiguration(new SqliteFactory());
var repo = new GenericRepository<RequestedModel>(db);
var entity = repo.GetAll().FirstOrDefault(x => x.Tmdbid == tmdbId);
repo.Delete(entity);
}
}
}