aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-02-20 22:55:15 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-02-20 22:55:15 +0200
commit9447a8a09f87d6ea2cb62860021c595386668eec (patch)
treea02db15a1247587f14fedb6ccae76f79bd63afb3 /Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs
parent17446569ca8d8dd00331da5926b938593c4b117f (diff)
downloadTango-9447a8a09f87d6ea2cb62860021c595386668eec.tar.gz
Tango-9447a8a09f87d6ea2cb62860021c595386668eec.zip
A lot of work !!!
Diffstat (limited to 'Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs')
-rw-r--r--Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs76
1 files changed, 0 insertions, 76 deletions
diff --git a/Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs b/Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs
deleted file mode 100644
index 1fae9cccc..000000000
--- a/Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Security.Authentication;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Web;
-using System.Web.Http;
-using System.Web.Http.Controllers;
-using Tango.Logging;
-
-namespace Tango.Web.Controllers
-{
- public class JsonController : ApiController
- {
- protected LogManager LogManager { get; private set; }
-
- public JsonController()
- {
- LogManager = LogManager.Default;
- }
-
- public override async Task<HttpResponseMessage> ExecuteAsync(HttpControllerContext context, CancellationToken cancellationToken)
- {
- string controllerName = String.Empty;
- string actionName = String.Empty;
-
- try
- {
- var routeData = HttpContext.Current.Request.RequestContext.RouteData;
- actionName = routeData.Values["action"].ToString();
- controllerName = routeData.Values["controller"].ToString();
- }
- catch { }
-
- try
- {
- String request = String.Empty;
-
- try
- {
- request = context.Request.Content.ReadAsStringAsync().Result;
- }
- catch {}
-
- LogManager.Log($"Request Received on {controllerName + "/" + actionName}: \n{request}");
-
- var result = await base.ExecuteAsync(context, cancellationToken);
- return result;
- }
- catch (Exception ex)
- {
- LogManager.Log(ex, $"An error occurred while processing the request message on {controllerName + "/" + actionName}.");
-
- HttpStatusCode code = HttpStatusCode.InternalServerError;
-
- if (ex is ArgumentException)
- {
- code = HttpStatusCode.BadRequest;
- }
- else if (ex is AuthenticationException)
- {
- code = HttpStatusCode.Unauthorized;
- }
-
-#if DEBUG
- throw new HttpResponseException(Request.CreateErrorResponse(code, ex.ToString()));
-#else
- throw new HttpResponseException(Request.CreateErrorResponse(code, ex.FlattenMessage()));
-#endif
- }
- }
- }
-} \ No newline at end of file