11using System ;
2+ using System . Globalization ;
23using Microsoft . AspNetCore . Mvc ;
34using NCS . Imp ;
45
@@ -12,7 +13,7 @@ public class NcsRestController : ControllerBase
1213 [ Produces ( "application/json" ) ]
1314 public IActionResult CheckTriangle ( int a , int b , int c )
1415 {
15- var dto = new Dto { ResultAsInt = TriangleClassification . Classify ( a , b , c ) } ;
16+ var dto = new Dto { Result = TriangleClassification . Classify ( a , b , c ) . ToString ( ) } ;
1617
1718 return Ok ( dto ) ;
1819 }
@@ -26,7 +27,7 @@ public IActionResult Bessj(int n, double x)
2627 return BadRequest ( ) ;
2728 }
2829
29- var dto = new Dto { ResultAsDouble = new Bessj ( ) . BessjFunction ( n , x ) } ;
30+ var dto = new Dto { Result = new Bessj ( ) . BessjFunction ( n , x ) . ToString ( CultureInfo . InvariantCulture ) } ;
3031
3132 return Ok ( dto ) ;
3233 }
@@ -37,13 +38,13 @@ public IActionResult Expint(int n, double x)
3738 {
3839 try
3940 {
40- var dto = new Dto { ResultAsDouble = Imp . Expint . Exe ( n , x ) } ;
41+ var dto = new Dto { Result = Imp . Expint . Exe ( n , x ) . ToString ( CultureInfo . InvariantCulture ) } ;
4142
4243 return Ok ( dto ) ;
4344 }
4445 catch ( Exception e )
4546 {
46- return BadRequest ( e ) ;
47+ return BadRequest ( e . Message ) ;
4748 }
4849 }
4950
@@ -58,13 +59,13 @@ public IActionResult Fisher(int m, int n, double x)
5859
5960 try
6061 {
61- var dto = new Dto { ResultAsDouble = Imp . Fisher . Exe ( m , n , x ) } ;
62+ var dto = new Dto { Result = Imp . Fisher . Exe ( m , n , x ) . ToString ( CultureInfo . InvariantCulture ) } ;
6263
6364 return Ok ( dto ) ;
6465 }
6566 catch ( Exception e )
6667 {
67- return BadRequest ( e ) ;
68+ return BadRequest ( e . Message ) ;
6869 }
6970 }
7071
@@ -78,13 +79,13 @@ public IActionResult Gammq(double a, double x)
7879
7980 var gammq = new Gammq ( ) ;
8081
81- dto . ResultAsDouble = gammq . Exe ( a , x ) ;
82+ dto . Result = gammq . Exe ( a , x ) . ToString ( CultureInfo . InvariantCulture ) ;
8283
8384 return Ok ( dto ) ;
8485 }
8586 catch ( Exception e )
8687 {
87- return BadRequest ( e ) ;
88+ return BadRequest ( e . Message ) ;
8889 }
8990 }
9091
@@ -99,7 +100,7 @@ public IActionResult Remainder(int a, int b)
99100 return BadRequest ( ) ;
100101 }
101102
102- var dto = new Dto { ResultAsInt = Imp . Remainder . Exe ( a , b ) } ;
103+ var dto = new Dto { Result = Imp . Remainder . Exe ( a , b ) . ToString ( ) } ;
103104
104105 return Ok ( dto ) ;
105106 }
0 commit comments