예제 #1
0
        public async Task <IActionResult> OnPostSetVMLogStateAsync([FromBody] JObject jobject)
        {
            Log log = new Log();

            log.name          = jobject["name"].ToString();
            log.timestamp     = DateTime.UtcNow;
            log.vmname        = jobject["vmname"].ToString();
            log.country       = jobject["country"].ToString();
            log.region        = jobject["region"].ToString();
            log.resourcegroup = jobject["resourcegroup"].ToString();
            log.city          = jobject["city"].ToString();
            log.ip            = jobject["ip"].ToString();
            log.key           = jobject["key"].ToString();
            log.subscription  = jobject["subscription"].ToString();

            _context.Logs.Add(log);
            await _context.SaveChangesAsync();

            DashboardHelper.CleanLogs(_context);
            return(await Task.Run(() => new JsonResult(new { data = "log" })));
        }
예제 #2
0
 public IActionResult OnPostCleanLogs()
 {
     DashboardHelper.CleanLogs(_context);
     return(new JsonResult(new { data = "successfull" }));
 }