Пример #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 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);
            }
        }