public void CreateEndPointLog(EndPointContext context, string body, EndPointType type) { if (context == null) { return; } EndPointLog log = new EndPointLog { ClientIp = context.ClientIP, Body = body, TimeStamp = DateTime.Now, EndPointType = type }; database.StoreEndPointLog(log); }
// Endpointlog store public DataResult <EndPointLog> StoreEndPointLog(EndPointLog log) { DataResult <EndPointLog> result = new DataResult <EndPointLog>(); if (!mOnline) { result.Success = false; result.ErrorMessage = DB_ERROR; return(result); } try { GetEndPointLogCollection().InsertOne(log); result.Success = true; } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }