コード例 #1
0
        public IActionResult Add([FromQuery] StudentQuestionAnswerViewModel model)
        {
            var StudentQuestionResponse = _StudentQuestionService.Add(new StudentQuestionAnswer
            {
                StudentId  = model.StudentId,
                QuestionId = model.QuestionId,
                AnswerId   = model.AnswerId
            });

            if (StudentQuestionResponse.IsSucceeded && StudentQuestionResponse.Result != null)
            {
                return(Ok(StudentQuestionResponse.Result));
            }
            return(StudentQuestionResponse.HttpGetResponse());
        }
コード例 #2
0
        public IActionResult Edit(int id, StudentQuestionAnswerViewModel model)
        {
            var getStudentQuestion = _StudentQuestionService.GetStudentQuestionAnswerById(id);

            if (getStudentQuestion != null && getStudentQuestion.IsSucceeded)

            {
                getStudentQuestion.Result.StudentId = model.StudentId;

                var updateResult = _StudentQuestionService.Update(getStudentQuestion.Result);

                if (updateResult.IsSucceeded)

                {
                    return(Ok(updateResult.Result));
                }
                return(updateResult.HttpGetResponse());
            }
            return(getStudentQuestion.HttpGetResponse());
        }