Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6a728f6

Browse files
author
ad
committed
Update
1 parent d47be6b commit 6a728f6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Controllers/UsersController.cs

+18
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5+
using System.Net.Http;
56
using Microsoft.AspNetCore.Mvc;
67
using Microsoft.AspNetCore.Authorization;
78
using dvcsharp_core_api.Models;
@@ -41,5 +42,22 @@ public IActionResult Delete(int id)
4142

4243
return Ok(user);
4344
}
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+
}
4462
}
4563
}

0 commit comments

Comments
 (0)