public JsonResult UpdateParticipantAnswer([DataSourceRequest]DataSourceRequest request, AnswerViewModelType model)
        {
            var participantAnswer = this.Data.Participants
                .GetById(model.ParticipantId)
                .Answers
                .First(a => a.ContestQuestionId == model.ContestQuestionId);

            participantAnswer.Answer = model.Answer;
            participantAnswer.Participant = this.Data.Participants.GetById(model.ParticipantId);
            participantAnswer.ContestQuestion = this.Data.ContestQuestions.GetById(model.ContestQuestionId);
            this.Data.SaveChanges();

            return this.GridOperation(request, model);
        }
Exemple #2
0
        public JsonResult UpdateParticipantAnswer([DataSourceRequest] DataSourceRequest request, AnswerViewModelType model)
        {
            var participantAnswer = this.Data.Participants
                                    .GetById(model.ParticipantId)
                                    .Answers
                                    .First(a => a.ContestQuestionId == model.ContestQuestionId);

            participantAnswer.Answer          = model.Answer;
            participantAnswer.Participant     = this.Data.Participants.GetById(model.ParticipantId);
            participantAnswer.ContestQuestion = this.Data.ContestQuestions.GetById(model.ContestQuestionId);
            this.Data.SaveChanges();

            return(this.GridOperation(request, model));
        }