public async Task<IHttpActionResult> Update(QuestionDTO questionDto) { string token = Request.Headers.GetValues("Authorization").FirstOrDefault(); _questionProvider.UpdateQuestion(questionDto); Logger.Logger.Instance.LogAction(LoggerHelper.GetActionString(TokenHelper.GetFromToken(token, "username"), "Question Updated ")); return Content(HttpStatusCode.OK, "Updated successfully"); }
public int CreateQuestion(QuestionDTO dtoQuestion) { var question = Mapper.Map<Question>(dtoQuestion); question.Module = _moduleRepository.Get(u => u.ModuleId == dtoQuestion.ModuleId); //var test = _testRepository.Get(u => u.TestId == dtoQuestion.TestId); //test.Questions.Add(question); _questionRepository.Add(question); _questionRepository.SaveChanges(); // _testRepository.SaveChanges(); return question.QuestionId; }
public void UpdateQuestion(QuestionDTO dtoQuestion) { var question = _questionRepository.Get(u => u.QuestionId == dtoQuestion.QuestionId); question.Score = dtoQuestion.Score; question.Text = dtoQuestion.Text; _questionRepository.SaveChanges(); }