public async Task <ActionResult <SetQuestion> > PostSetAnswer(int setId, int questionId, [FromBody] SetAnswerIM item) { var set = await _context.Sets.FindAsync(setId); if (set == null) { return(NotFound("set not found")); } var @question = await _context.SetQuestions.FindAsync(questionId); if (@question == null) { return(NotFound("question not found")); } var newAnswer = new SetAnswer { SetQuestionId = questionId, Text = item.Text, Description = item.Description, Rating = item.Rating, Critical = item.Critical, CriticalInTerm = item.CriticalInTerm }; _context.SetAnswers.Add(newAnswer); await _context.SaveChangesAsync(); return(Ok(newAnswer)); }
public async Task <ActionResult <SetTerm> > PutSetAnswer(int setId, int id, [FromBody] SetAnswer sa) { var @answer = await _context.SetAnswers.FindAsync(id); if (@answer == null) { return(NotFound("answer not found")); } answer.Text = sa.Text; answer.Description = sa.Description; answer.Critical = sa.Critical; answer.Rating = sa.Rating; await _context.SaveChangesAsync(); return(Ok(answer)); }
public Task HandleAsync(IWebSocketRemoteDevice device, SetAnswer args) { return(_answerHandler.HandleAsync(device, args.PeerConnectionId, args.OfferId, args.Answer)); }