コード例 #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);
        }
コード例 #2
0
 public async Task<HttpResponseMessage> Create(QuestionDto question)
 {
     await _questionsService.Create(question).ConfigureAwait(false);
     return Request.CreateResponse(HttpStatusCode.Created);
 }
コード例 #3
0
 public async Task Create(QuestionDto question)
 {
     var entity = Mapper.Map<QuestionEntity>(question);
     _db.Questions.Add(entity);
     await _db.SaveChangesAsync().ConfigureAwait(false);
 }