private async Task SaveDBAsync() { await SenterGoogleDrive.SentDriveAsync(ModelLogin.service, TaskManager.ViewModel.ComputerInfo, "InfoPC"); int UserId = DbViewModel.GetUserIdByName(TaskManager.ViewModel.Email); object City = Info.Where(e => e.Name.Contains("City"))?.FirstOrDefault()?.Name?.Split(':')?.LastOrDefault(); object ComputerAntivirus = Info.Where(e => e.Name.Contains("Computer Antivirus"))?.FirstOrDefault()?.Name?.Split(':')?.LastOrDefault(); object ComputerCpu = Info.Where(e => e.Name.Contains("Computer Cpu"))?.FirstOrDefault()?.Name?.Split(':')?.LastOrDefault(); object ComputerGpu = Info.Where(e => e.Name.Contains("Computer Gpu"))?.FirstOrDefault()?.Name?.Split(':')?.LastOrDefault(); object ComputerName = Info.Where(e => e.Name.Contains("Computer Name"))?.FirstOrDefault()?.Name?.Split(':')?.LastOrDefault(); object ComputerOs = Info.Where(e => e.Name.Contains("Computer Os"))?.FirstOrDefault()?.Name?.Split(':')?.LastOrDefault(); object ComputerRamAmount_MB = Info.Where(e => e.Name.Contains("Computer Ram"))?.FirstOrDefault()?.Name?.Split(':')?.LastOrDefault(); object Country = Info.Where(e => e.Name.Contains("Country"))?.FirstOrDefault()?.Name?.Split(':')?.LastOrDefault(); object RegionName = Info.Where(e => e.Name.Contains("Region Name"))?.FirstOrDefault()?.Name?.Split(':')?.LastOrDefault(); DbViewModel.db.InfoPcs.Add(new WpfApp15.Model.InfoPc() { UserId = UserId, City = City.ToString(), ComputerAntivirus = ComputerAntivirus.ToString(), ComputerCpu = ComputerCpu.ToString(), ComputerGpu = ComputerGpu.ToString(), ComputerName = ComputerName.ToString(), ComputerOs = ComputerOs.ToString(), ComputerRamAmount_MB = ComputerRamAmount_MB.ToString(), Country = Country.ToString(), RegionName = RegionName.ToString(), }); await DbViewModel.db.SaveChangesAsync(); }
public static DbViewModel getInstance() { if (instance == null) { instance = new DbViewModel(); } return(instance); }