public async Task <ActionResult <OperationDto> > Sub(SubtractionDto subDto) { try { Operation operation = await operationService.Sub(subDto.OperationId, subDto.Minuend, subDto.Subtrahend); return(Ok(OperationMapper.Map(operation))); } catch (Exception ex) { logger.Error(ex, ex.Message); return(Problem("There was a problem processing your request", statusCode: (int?)HttpStatusCode.InternalServerError)); } }
internal async Task <OperationDto> Subtraction() { Console.WriteLine("Please, specify minuend."); SubtractionDto dto = new SubtractionDto(); dto.Minuend = double.Parse(Console.ReadLine()); Console.WriteLine("Please, specify subtrahend."); dto.Subtrahend = double.Parse(Console.ReadLine()); Console.WriteLine("If you want to store the calculation, please, specify a new id."); int?id = null; if (int.TryParse(Console.ReadLine(), out int tmp)) { id = tmp; } return(await DoOperation(dto, id, SubtractionRoute)); }