private void HttpServer_DeviceRegistration(string DeviceSerialNumber, DateTime LastPingTime, DateTime InstalledDate, double Longitude, double Latitude) { int C = S1.CMDeviceInfoes.Where(T => T.DeviceSerialNumber.Trim().Equals(DeviceSerialNumber)).Count(); if (C == 0) { CMDeviceInfo C1 = new CMDeviceInfo(); C1.DeviceSerialNumber = DeviceSerialNumber; C1.InstallationDate = InstalledDate; C1.LastOnlineTime = LastPingTime; C1.Latitude = Latitude; C1.Longitude = Longitude; S1.CMDeviceInfoes.Add(C1); S1.SaveChanges(); } }