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 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 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;
        }
        public bool UpdateRating(RatingHistory ratings)
        {
            var cont = new Raw12Context();

            var dbCat = GetRating(ratings.UserId);

            if (dbCat == null)
            {
                return(false);
            }

            dbCat.Rating  = ratings.Rating;
            dbCat.TitleId = ratings.TitleId;

            cont.RatingHistory.Update(dbCat);
            cont.SaveChanges();

            return(true);
        }
        public bool UpdateSearch(SearchHistory searches)
        {
            var cont = new Raw12Context();

            var dbCat = GetSearch(searches.UserId);

            if (dbCat == null)
            {
                return(false);
            }

            dbCat.Timestamp = searches.Timestamp;
            dbCat.Keyword   = searches.Keyword;

            cont.SearchHistory.Update(dbCat);
            cont.SaveChanges();

            return(true);
        }