コード例 #1
0
        public async Task <Response <MathOperationsDTO> > getAProduct(MathOperationsDTO mathOperationsDTO)
        {
            var response = new Response <MathOperationsDTO>();

            try
            {
                mathOperationsDTO.value2 = 2;

                mathOperationsDTO.result = mathOperationsDTO.value1 * mathOperationsDTO.value2;

                response.IsSuccess = await mathOperationsDomain.InsertAsync("getAProduct", mathOperationsDTO.result);

                if (response.IsSuccess)
                {
                    response.Data    = mathOperationsDTO;
                    response.Message = "getAProduct!!!";
                }
            }
            catch (Exception e)
            {
                response.Message = e.Message;
            }

            return(response);
        }
コード例 #2
0
        public async Task <IActionResult> GetASum([FromBody] MathOperationsDTO mathOperationsDTO)
        {
            if (mathOperationsDTO == null)
            {
                return(BadRequest());
            }

            var response = await mathOperationsApplication.getASum(mathOperationsDTO);

            if (response.IsSuccess)
            {
                return(Ok(response));
            }

            return(BadRequest(response.Message));
        }
コード例 #3
0
        public async Task <Response <MathOperationsDTO> > GetAPower(MathOperationsDTO mathOperationsDTO)
        {
            var response = new Response <MathOperationsDTO>();

            try
            {
                mathOperationsDTO.result = Math.Pow(mathOperationsDTO.value1, mathOperationsDTO.value2);

                response.IsSuccess = await mathOperationsDomain.InsertAsync("getAPower", mathOperationsDTO.result);

                if (response.IsSuccess)
                {
                    response.Data    = mathOperationsDTO;
                    response.Message = "getAPower!!!";
                }
            }
            catch (Exception e)
            {
                response.Message = e.Message;
            }

            return(response);
        }