Beispiel #1
0
        public async Task <bool> UpdateEntityByIdAsync(QuestionDto request, int id)
        {
            var entity  = ConvertService.ConvertToStringAnswers(request, _mapper);
            var updated = await _uow.QuestionRepository.UpdateAsync(entity);

            return(await _uow.SaveAsync());
        }
Beispiel #2
0
        public async Task <QuestionDto> CreateEntityAsync(QuestionDto request)
        {
            var entity = ConvertService.ConvertToStringAnswers(request, _mapper);

            entity = await _uow.QuestionRepository.CreateAsync(entity);

            var result = await _uow.SaveAsync();

            request.Id = entity.Id;
            return(!result || entity == null ? null : request);
        }
Beispiel #3
0
        public async Task <IEnumerable <QuestionDto> > GetAllEntitiesAsync()
        {
            var entities = await _uow.QuestionRepository.GetAsync();

            return(ConvertService.ConvertToListAnswers(entities, _mapper));
        }
Beispiel #4
0
        public async Task <QuestionDto> GetEntityByIdAsync(int id)
        {
            var entities = await _uow.QuestionRepository.GetAsync(o => o.Id == id);

            return(entities == null ? null : ConvertService.ConvertToListAnswers(entities, _mapper).FirstOrDefault());
        }
        public async Task <IEnumerable <QuestionDto> > GetAllEntitiesBySurveyIdAsync(int surveyId)
        {
            var entities = await _uow.QuestionRepository.GetAsync(o => o.SurveyId == surveyId);

            return(ConvertService.ConvertToListAnswers(entities, _mapper));
        }