Logic.cs 519 B

12345678910111213141516
  1. using Microsoft.AspNetCore.Mvc;
  2. using Newtonsoft.Json;
  3. using log4net;
  4. namespace CMS.Common;
  5. public class Logic
  6. {
  7. private static readonly ILog log = LogManager.GetLogger(typeof(Program));
  8. public static IActionResult BuildResponseAsync(string url, string request, int errorCode, string message, object data)
  9. {
  10. log.Info("URL: " + url + " => Request: " + request + "\n Response: " + JsonConvert.SerializeObject(new { errorCode, message, data }));
  11. return new OkObjectResult(new { errorCode, message, data });
  12. }
  13. }