public async Task <IActionResult> Create(CreateSurveyModel model) { var id = 0; if (ModelState.IsValid) { var dateTime = DateTime.UtcNow; var dateOffset = dateTime.AddMinutes(model.NeedToBeFinishedFor.TotalMinutes); id = await _repository.AddAsync(new Survey { Title = model.Title, Text = model.Text, CreatedAt = dateTime, Limit = model.Limit, NeedToBeFinishedFor = dateOffset, NeedToBeFinishedForStart = dateTime, Score = model.Score, IsActive = false }); return(RedirectToAction("CreateAdditionalInfo", "Survey", new { surveyId = id })); } return(View(model)); }
public async Task <int> CreateAsync(string title, string description) { var survey = new Survey(title, description); await _surveyRepository.AddAsync(survey); return(survey.Id); }
public async Task AddSurvey(SurveyDto dto) { var survey = _mapper.Map <Survey>(dto); await _surveyRepository.AddAsync(survey); dto.Id = survey.Id; }