answerService.go 428 B

12345678910111213141516171819
  1. package service
  2. import (
  3. "confrontation-training/global"
  4. "confrontation-training/models"
  5. )
  6. type AnswerService struct {
  7. }
  8. func (a *AnswerService) CreateNewAnswer(param models.CreateAnswer) (models.Answer, int64) {
  9. answer := models.Answer{
  10. Answer: param.Answer,
  11. QuestionId: param.QuestionId,
  12. NextQuestionId: param.NextQuestionId,
  13. }
  14. count := global.Db.Create(&answer).RowsAffected
  15. return answer, count
  16. }