Update 20241112
This commit is contained in:
18
ILMocup/Controllers/HomeController.cs
Normal file
18
ILMocup/Controllers/HomeController.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace ILMocup.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
public ActionResult Index()
|
||||
{
|
||||
ViewBag.Title = "Home Page";
|
||||
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
65
ILMocup/Controllers/ILController.cs
Normal file
65
ILMocup/Controllers/ILController.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using Swashbuckle.Swagger;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace ILMocup.Controllers
|
||||
{
|
||||
public class ILController : ApiController
|
||||
{
|
||||
[HttpPost]
|
||||
[Route("API/Fast")]
|
||||
|
||||
public IHttpActionResult Fast()
|
||||
{
|
||||
string json = "";
|
||||
if (HttpContext.Current.Request.InputStream.Length > 0)
|
||||
{
|
||||
using (var inputStream = new StreamReader(HttpContext.Current.Request.InputStream))
|
||||
{
|
||||
json = inputStream.ReadToEnd();
|
||||
}
|
||||
}
|
||||
string filename = @"X:\jsontemp\ILMockup" + @"\fast_" + DateTime.Now.ToString("yyyymmdd_hhMMss") + ".json";
|
||||
System.IO.File.WriteAllText(filename, json);
|
||||
|
||||
|
||||
return Content(HttpStatusCode.OK, RandomString(6));
|
||||
}
|
||||
[HttpPost]
|
||||
[Route("API/Slow")]
|
||||
public IHttpActionResult Slow()
|
||||
{
|
||||
string json = "";
|
||||
string rs = RandomString(6);
|
||||
if (HttpContext.Current.Request.InputStream.Length > 0)
|
||||
{
|
||||
using (var inputStream = new StreamReader(HttpContext.Current.Request.InputStream))
|
||||
{
|
||||
json = inputStream.ReadToEnd();
|
||||
}
|
||||
}
|
||||
string filename = @"X:\jsontemp\ILMockup" + @"\Slow_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + "_"+rs+".json";
|
||||
System.IO.File.WriteAllText(filename, json);
|
||||
|
||||
|
||||
return Content(HttpStatusCode.OK, rs);
|
||||
}
|
||||
|
||||
private static Random random = new Random();
|
||||
|
||||
public static string RandomString(int length)
|
||||
{
|
||||
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
return new string(Enumerable.Repeat(chars, length)
|
||||
.Select(s => s[random.Next(s.Length)]).ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
39
ILMocup/Controllers/ValuesController.cs
Normal file
39
ILMocup/Controllers/ValuesController.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace ILMocup.Controllers
|
||||
{
|
||||
public class ValuesController : ApiController
|
||||
{
|
||||
// GET api/values
|
||||
public IEnumerable<string> Get()
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
}
|
||||
|
||||
// GET api/values/5
|
||||
public string Get(int id)
|
||||
{
|
||||
return "value";
|
||||
}
|
||||
|
||||
// POST api/values
|
||||
public void Post([FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// PUT api/values/5
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user