Advertisement
bappi2097

Auditing and logging

Jul 28th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. public async Task<IActionResult> Index()
  2. {
  3. JObject clientInfo = getClientInformation();
  4. AuditLogging audit = new AuditLogging();
  5. audit.IPAddress = (string)clientInfo["IPv4"];
  6. audit.Location = (string)clientInfo["latitude"] + "," + (string)clientInfo["longitude"] + "," + (string)clientInfo["city"];
  7. audit.TimeOfAction = DateTime.Now;
  8. _context.Add(audit);
  9. await _context.SaveChangesAsync();
  10.  
  11. // Return a message "Index0", To load _LoadChartIndex0 in /Elections
  12. ViewBag.message = "Index0";
  13. return View(await _context.Elections.ToListAsync());
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement