public HttpResponseMessage PostQuestion([FromBody] QuestionDataModel model) { var rez = _questionDal.AddQueston(model.Text, model.DifficultyID, model.SubjectId, model.TypeId); foreach (var answer in model.Answers) { if (String.IsNullOrEmpty(answer.Text)) { continue; } _answerDal.AddAnswer(answer.Text, answer.Value, rez.Id); } return(Request.CreateResponse(HttpStatusCode.Created, new { Message = "Question has been created" })); }