// ratings dataservice public IList <RatingHistory> RatingsToList() { var ctx = new Raw12Context(); var ratings = ctx.RatingHistory.ToList(); return(ratings); }
public RatingHistory GetRating(int id) { var ctx = new Raw12Context(); var ratings = ctx.RatingHistory; return(ratings.FirstOrDefault(x => x.UserId == id)); }
// Framework Dataservice //////// // Users data service public IList <Users> UserToList() { var ctx = new Raw12Context(); var users = ctx.Users.ToList(); return(users); }
// genres dataservice public IList <Genres> GenresToList() { var ctx = new Raw12Context(); var genres = ctx.Genres.ToList(); return(genres); }
public SearchHistory GetSearch(int id) { var ctx = new Raw12Context(); var searches = ctx.SearchHistory; return(searches.FirstOrDefault(x => x.UserId == id)); }
public Details GetDetail(string id) { var ctx = new Raw12Context(); var details = ctx.Details; return(details.FirstOrDefault(x => x.TitleId == id)); }
// omdb dataservice public IList <Omdb> OmdbToList() { var ctx = new Raw12Context(); var omdb = ctx.Omdb.ToList(); return(omdb); }
public Genres GetGenre(string id) { var ctx = new Raw12Context(); var genres = ctx.Genres; return(genres.FirstOrDefault(x => x.TitleId == id)); }
public Users GetUser(int id) { var ctx = new Raw12Context(); var users = ctx.Users; return users.FirstOrDefault(x => x.UserId == id); }
public Movies GetMovie(string id) { var ctx = new Raw12Context(); var movies = ctx.Movies; return(movies.FirstOrDefault(x => x.TitleId.Trim() == id.Trim())); //trim to fix id whitespace }
// searchhistory data service public IList <SearchHistory> SearchToList() { var ctx = new Raw12Context(); var searches = ctx.SearchHistory.ToList(); return(searches); }
public Actors GetActor(string id) { var ctx = new Raw12Context(); var actors = ctx.Actors; return(actors.FirstOrDefault(x => x.Nconst == id)); }
// movies dataservice public IList <Movies> MoviesToList() { var ctx = new Raw12Context(); var movies = ctx.Movies.ToList(); return(movies); }
public ActorBookmarking GetABooking(int id) { var ctx = new Raw12Context(); var abookings = ctx.ActorBook; return(abookings.FirstOrDefault(x => x.UserId == id)); }
//Movie Data dataservices /////////////// // actors dataservice public IList <Actors> ActorsToList() { var ctx = new Raw12Context(); var actors = ctx.Actors.ToList(); return(actors); }
// actor bookings dataservice public IList <ActorBookmarking> ABookToList() { var ctx = new Raw12Context(); var abookings = ctx.ActorBook.ToList(); return(abookings); }
public TitleBookmarking GetTBooking(int id) { var ctx = new Raw12Context(); var tbookings = ctx.TitleBook; return(tbookings.FirstOrDefault(x => x.UserId == id)); }
// title bookings dataservice public IList <TitleBookmarking> TBookToList() { var ctx = new Raw12Context(); var tbookings = ctx.TitleBook.ToList(); return(tbookings); }
public Omdb GetOmdb(string id) { var ctx = new Raw12Context(); var omdb = ctx.Omdb; return(omdb.FirstOrDefault(x => x.Tconst == id)); }
public Directors GetDirector(string id) { var ctx = new Raw12Context(); var directors = ctx.Directors; return(directors.FirstOrDefault(x => x.TitleId == id)); }
// details dataservice public IList <Details> DetailsToList() { var ctx = new Raw12Context(); var details = ctx.Details.ToList(); return(details); }
// director dataservice public IList <Directors> DirectorsToList() { var ctx = new Raw12Context(); var directors = ctx.Directors.ToList(); return(directors); }
// language dataservice public IList <Languages> LanguagesToList() { var ctx = new Raw12Context(); var languages = ctx.Languages.ToList(); return(languages); }
public Languages GetLanguage(string id) { var ctx = new Raw12Context(); var languages = ctx.Languages; return(languages.FirstOrDefault(x => x.TitleId == id)); }
public void CreateSearch(SearchHistory searches) { var cont = new Raw12Context(); var maxId = SearchToList().Max(x => x.UserId); searches.UserId = maxId + 1; cont.SearchHistory.Add(searches); cont.SaveChanges(); }
public void CreateUser(Users users) { var cont = new Raw12Context(); var maxId = UserToList().Max(x => x.UserId); users.UserId = maxId + 1; cont.Users.Add(users); cont.SaveChanges(); }
public void CreateRating(RatingHistory ratings) { var cont = new Raw12Context(); var maxId = RatingsToList().Max(x => x.UserId); ratings.UserId = maxId + 1; cont.RatingHistory.Add(ratings); cont.SaveChanges(); }
public bool DeleteUser(int id) { var cont = new Raw12Context(); var dbCat = GetUser(id); if (dbCat == null) { return false; } cont.Users.Remove(dbCat); cont.SaveChanges(); return true; }
public bool DeleteRating(int id) { var cont = new Raw12Context(); var dbCat = GetRating(id); if (dbCat == null) { return(false); } cont.RatingHistory.Remove(dbCat); cont.SaveChanges(); return(true); }
public bool UpdateUser(Users users) { var cont = new Raw12Context(); var dbCat = GetUser(users.UserId); if (dbCat == null) { return false; } dbCat.Username = users.Username; dbCat.Email = users.Email; dbCat.Password = users.Password; cont.Users.Update(dbCat); cont.SaveChanges(); return true; }