예제 #1
0
        public async Task Update(int id, UpdateSurveyDto updateData)
        {
            if (updateData == null)
            {
                throw new ArgumentNullException(nameof(updateData));
            }

            var itemToUpdate = await _repository.GetById(id);

            if (itemToUpdate == null)
            {
                throw new InvalidOperationException();
            }

            _mapper.Map(updateData, itemToUpdate);
            await _repository.Update(itemToUpdate);
        }
예제 #2
0
        public async Task <IActionResult> Put(int id, [FromBody] UpdateSurveyDto newSurvey)
        {
            await _surveysService.Update(id, newSurvey);

            return(NoContent());
        }