public async Task <Guid> AddSurvey(SurveyVm viewModel) { await _modelValidator.ValidateAsync <SurveyVm, SurveyVmValidator>(viewModel); var model = _objectMapper.Map <SurveyVm, Core.Model.Survey>(viewModel); model.SurveyStatus = Core.Enum.SurveyStatus.BeingEntered; _appRepository.Create(model); await _appRepository.SaveAsync(); return(model.Id); }
public async Task <AkselModel> AddAsync(AkselModel model) { await _modelValidator.ValidateAsync(model); AkselEntity entity = _mapper.Map <AkselEntity>(model); EntityEntry <AkselEntity> AkselEntity = await _AkselRepository.AddAsync(entity); await _unitOfWork.SaveChangesAsync(); AkselModel AkselModel = _mapper.Map <AkselModel>(AkselEntity.Entity); return(AkselModel); }
public async Task <Guid> Add(PalindromeVm viewModel) { await _modelValidator.ValidateAsync <PalindromeVm, PalindromeVmValidator>(viewModel); var model = _objectMapper.Map <PalindromeVm, PalindromeModel>(viewModel); _appRepository.Create(model); await _appRepository.SaveAsync(); return(model.Id); }