File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 2
2
using System . Collections . Generic ;
3
3
using System . Linq ;
4
4
using System . Threading . Tasks ;
5
+ using System . Net . Http ;
5
6
using Microsoft . AspNetCore . Mvc ;
6
7
using Microsoft . AspNetCore . Authorization ;
7
8
using dvcsharp_core_api . Models ;
@@ -41,5 +42,22 @@ public IActionResult Delete(int id)
41
42
42
43
return Ok ( user ) ;
43
44
}
45
+
46
+ [ Authorize ]
47
+ [ HttpGet ( "import" ) ]
48
+ public async Task < IActionResult > Import ( )
49
+ {
50
+ HttpClient client = new HttpClient ( ) ;
51
+ var url = HttpContext . Request . Query [ "url" ] . ToString ( ) ;
52
+
53
+ //Console.WriteLine("URL: " + url);
54
+ HttpResponseMessage response = await client . GetAsync ( url ) ;
55
+ response . EnsureSuccessStatusCode ( ) ;
56
+ string responseBody = await response . Content . ReadAsStringAsync ( ) ;
57
+
58
+ // TODO: Parse JSON and import users
59
+
60
+ return Ok ( responseBody ) ;
61
+ }
44
62
}
45
63
}
You can’t perform that action at this time.
0 commit comments