public IHttpActionResult SubmitQuestion(SubmitQuestionRequest submitQuestionRequest) { if (!ModelState.IsValid) { return(BadRequest()); } var questionTags = new List <QuestionTag>(); foreach (var tag in submitQuestionRequest.QuestionTags) { var t = HackDbContext.QuestionTags.SingleOrDefault(x => x.Tag.Equals(tag.Name)); if (t != null) { questionTags.Add(t); } } var question = new Question(submitQuestionRequest.Title, submitQuestionRequest.Description, questionTags, DateTime.UtcNow, ApplicationContext.User.UserId); HackDbContext.Questions.Add(question); HackDbContext.SaveChanges(); return(Ok(new SubmitQuestionResponse(question.Id))); }
public SubmitQuestionResponse SubmitQuestion(SubmitQuestionRequest request) { throw new NotImplementedException(); }