public IActionResult GetAllStatementForms(int id, [FromServices] IIoTManager ioTManager) { List <Form> forms = _formManager.GetAllStatementForms(id).ToList(); List <FormViewModel> formViewModels = new List <FormViewModel>(); foreach (Form form in forms) { IotLink iotLink = ioTManager.GetIoTLinkByForm(form); FormViewModel formViewModel = new FormViewModel() { Title = form.Title, FormId = form.FormId, Questions = new List <FormQuestionViewModel>(), IotLink = iotLink }; FormQuestionViewModel question = new FormQuestionViewModel() { Question = form.Questions[0].QuestionString }; formViewModel.Questions.Add(question); formViewModels.Add(formViewModel); } return(Ok(formViewModels)); }