public async Task <IActionResult> DeleteMappingAsync([FromBody] DeleteObjectMapping command) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } await service.Execute(command); return(Ok()); }
public async Task Execute(DeleteObjectMapping command) { var mapping = await writeContext.SurveyObjectMapping.FindAsync(command.QuestionId, command.MappingType); if (mapping == null) { throw new EntityNotFoundException(typeof(SurveyObjectMapping), new { command.QuestionId, command.MappingType }); } writeContext.SurveyObjectMapping.Remove(mapping); await writeContext.SaveChangesAsync(); }