Ejemplo n.º 1
0
        public async Task Update(QuestionDto questionDto)
        {
            var question = await _db.Questions.FindAsync(questionDto.Id).ConfigureAwait(false);

            if (question == null)
                throw new NotFoundException();

            Mapper.Map(questionDto, question);

            await _db.SaveChangesAsync().ConfigureAwait(false);
        }
 public async Task<HttpResponseMessage> Create(QuestionDto question)
 {
     await _questionsService.Create(question).ConfigureAwait(false);
     return Request.CreateResponse(HttpStatusCode.Created);
 }
Ejemplo n.º 3
0
 public async Task Create(QuestionDto question)
 {
     var entity = Mapper.Map<QuestionEntity>(question);
     _db.Questions.Add(entity);
     await _db.SaveChangesAsync().ConfigureAwait(false);
 }