public bool AddQuestionnaire(string token, QuestionnaireScope scope) { if (!_userValidation.ValidateToken(token)) { throw new AddressAccessDeniedException(); } var res = _questionnaireRepository.Add(scope); _log.Information($"Operation finished with result: {res}"); return(res); }
public async Task Create(QuestionnaireCreateDTO model, string username) { if (model == null) { throw new AppException("Bad Request"); } var questionnaire = _mapper.Map <Questionnaire>(model); var questionnaireDetail = _mapper.Map <QuestionnaireDetail>(model); questionnaire.ID = Guid.NewGuid().ToString(); questionnaire.CreatedBy = username; questionnaire.CreatedDate = DateTime.Now; questionnaireDetail.QuestionID = questionnaire.ID; _questionnaireRepository.Add(questionnaire); await _questionnaireRepository.AddQuestionnaireDetail(questionnaireDetail); _unitOfWork.Commit(); }
public IActionResult AddQuestionnaire([FromRoute] int assignmentId, [FromBody] QuestionnaireDTO dto) { string username = this.GetUsername(); return(this.NoContent(() => _QuestionnaireRepo.Add(assignmentId, dto, username) > 0, _Logger)); }