Пример #1
0
        public bool addVote(users_vote temp)
        {
            try
            {
                db.users_vote.Add(temp);
                db.SaveChanges();
                return true;
            }

            catch
            {
               // db.users_vote.Remove(temp);

                return false;
            }
        }
Пример #2
0
        public ActionResult addSimilarMovie(AddSimilarMovieModel newSimilar)
        {
            movie_relation temp = new movie_relation();

            int secondMovieId = dbMovie.getMovieByTitle(newSimilar.secondMovieTitle.ToLower().Trim()).id;

            temp.movie_1_id = newSimilar.firstMovieId;
            temp.movie_2_id = secondMovieId;
            temp.auto_created = false;

            dbMovie.AddNewSimilarMovie(temp);

            users_vote tempVote = new users_vote();

            tempVote.vote = true;
            tempVote.user_id = newSimilar.userId;
            tempVote.movie_relation = dbMovie.getMovieRelationByMoviesIds(newSimilar.firstMovieId, secondMovieId);

            dbUser.addVote(tempVote);

            return RedirectToAction("Show", "Movie", new{ id = newSimilar.firstMovieId});
        }
Пример #3
0
        public ActionResult Vote(int relationId, string userName, int baseMovieId, bool vote)
        {
            users_vote temp = new users_vote();

            temp.relation_id = relationId;
            temp.user_id = dbUser.getIdbyName(userName);
            temp.vote = vote;

            dbUser.addVote(temp);

            return RedirectToAction("Show", "Movie", new { id = baseMovieId });
        }