public ActionResult GetLog() { IList<tblDemoBeacon> listObj = null; try { //listObj = new List<tblDemoBeacon>(); listObj = new TwitRapDBEntities().tblDemoBeacons.ToList().OrderByDescending(x => x.LogTime).ToList(); } catch (Exception ex) { return null; } return PartialView("LogsView", listObj); }
public string PutLog(int logtype, string deviceName, string zoneName) { try { tblDemoBeacon beaconObj = new tblDemoBeacon(); beaconObj.DeviceName = deviceName; beaconObj.ZoneName = zoneName; beaconObj.LogTime = DateTime.Now; beaconObj.Type = logtype; TwitRapDBEntities context = new TwitRapDBEntities(); context.tblDemoBeacons.Add(beaconObj); context.SaveChanges(); return "true"; } catch (Exception ex ) { return "Error in application: " + ex; } }