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); }
public async Task <IActionResult> Put(int id, [FromBody] UpdateSurveyDto newSurvey) { await _surveysService.Update(id, newSurvey); return(NoContent()); }