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); }
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); } }
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); }
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); } }