예제 #1
0
        public bool deleteAnswer(int id)
        {
            var output = databaseContext.answer.Single(x => x.AnswerId == id);

            if (output != null)
            {
                databaseContext.answer.Remove(output);
                UserReactionOperation userReactionOperation = new UserReactionOperation();
                userReactionOperation.deleteAllReaction(id);
                databaseContext.SaveChanges();
            }
            return(true);
        }
예제 #2
0
        public bool activateAnswer(int id)
        {
            var output = databaseContext.answer.Single(x => x.AnswerId == id);

            if (output != null)
            {
                output.AnswerActive = 1;
                UserReactionOperation userReactionOperation = new UserReactionOperation();
                userReactionOperation.activateAllReaction(id);
                databaseContext.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
        public bool deactivateAllAnswer(int id)
        {
            var output = databaseContext.answer.Where(d => d.QuestionId == id && d.AnswerActive == 1).ToList();

            if (output != null)
            {
                foreach (var answers in output)
                {
                    UserReactionOperation userReactionOperation = new UserReactionOperation();
                    userReactionOperation.deactivateAllReaction(answers.AnswerId);
                    answers.AnswerActive = 0;
                    databaseContext.SaveChanges();
                }
            }

            return(true);
        }
예제 #4
0
        public bool deleteAllAnswer(int id)
        {
            var output = databaseContext.answer.Where(d => d.QuestionId == id).ToList();

            if (output != null)
            {
                foreach (var answers in output)
                {
                    UserReactionOperation userReactionOperation = new UserReactionOperation();
                    userReactionOperation.deleteAllReaction(answers.AnswerId);
                    databaseContext.answer.Remove(answers);
                }
                databaseContext.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }