public async Task <IActionResult> Delete([FromRoute] int key) { return(await(await _mapperSourceTextRepository.GetAsync(key)) .ToValidation(Error.New($"Mapper source text {key} does not exist")) .AsTask() .MapT(async d => { await _mapperSourceTextRepository.DeleteAsync(d); return $"Remove Source mapper id {key} successfully"; }) .ToActionResultAsync()); }
public async Task <IActionResult> Delete([FromRoute] InputType key) { return(await(await _outputMappingRepository.GetAsync(key)) .ToValidation(Error.New($"Output mapping {key} does not exist")) .AsTask() .MapT(async d => { await _outputMappingRepository.DeleteAsync(d); return $"Remove output mapping {key} successfully"; }) .ToActionResultAsync()); }
public async Task <IActionResult> Delete([FromRoute] string key, [FromRoute] InputType inputType) { return(await(await _inputMappingRepository.SingleOrDefaultAsync(e => e.Key == key && e.InputType == inputType)) .ToValidation(Error.New($"Input mapping key {key} and type {inputType} does not exist")) .AsTask() .MapT(async im => { await _inputMappingRepository.DeleteAsync(im); return $"Remove input mapping key {key} and type {inputType} successfully"; }) .ToActionResultAsync()); }