public void MarkQuestionAsAnswered(int id, int userId)
        {
            var answeredEntity = new ExerciseQuestionAnswered()
            {
                UserId             = userId,
                CreatedDate        = DateTime.Now,
                ExerciseQuestionId = id
            };

            _context.ExerciseQuestionAnswereds.Add(answeredEntity);
            _context.SaveChanges();
        }
Exemplo n.º 2
0
        public void Save(ExerciseQuestionAnswered QuestionAnswered)
        {
            // Does it already exist?
            var exists  = QuestionAnswered.ExerciseQuestionAnsweredId != 0;
            var context = new SqlConfidenceContext();

            // Stop it saving any related objects
            QuestionAnswered.ExerciseQuestion = null;

            if (!exists)
            {
                context.ExerciseQuestionAnswereds.Add(QuestionAnswered);
            }
            else
            {
                context.ExerciseQuestionAnswereds.Attach(QuestionAnswered);
                context.Entry(QuestionAnswered).State = EntityState.Modified;
            }

            context.SaveChanges();
        }
 protected ExerciseQuestionAnswered Create(ExerciseQuestionAnswered QuestionAnswered)
 {
     return(QuestionAnswered);
 }
 public void Save(ExerciseQuestionAnswered QuestionAnswered, UserModel user)
 {
     _questionAnsweredRepository.Save(QuestionAnswered);
 }