public async Task <ActionResult> Create(SurveyModel survey) { var surveyDto = _mapper.Map <Survey>(survey); await _surveyManager.Create(surveyDto); return(Ok()); }
public async Task GivenSurvey_WhenCreate_ThenCreateSuccessful() { //?Given var survey = GetSurvey(); //?When await _surveyManager.Create(survey); //?Then _mockRepository.Verify(t => t.Create(It.Is <Survey>(e => MessageeIsWellCreated(e, survey))), Times.Once); }
public async Task <IActionResult> Create([FromBody] Surveys inputModel) { try { inputModel.CreatedDate = DateTime.Now; var data = await _surveysManager.Create(inputModel); if (inputModel.Questions != null) { await CreateQuestion(inputModel); } return(Ok(data)); } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }