public void LogFileUploadEvent(string fileName) { DateTime now = DateTime.Now; LogModel logModel = new LogModel(); string combinedMessage = "Uploaded picture "+ fileName; logModel.date = now; logModel.description = combinedMessage; logModel.Username = ""; logModel.logEvent = LogEventType.FileUpload; db.Logs.Add(logModel); db.SaveChanges(); }
private void LogEvent(string username, string message, LogEventType logEvent) { DateTime now = DateTime.Now; LogModel logModel = new LogModel(); string combinedMessage = message + " for user: " + username; logModel.date = now; logModel.description = combinedMessage; logModel.Username = username; logModel.logEvent = logEvent; db.Logs.Add(logModel); db.SaveChanges(); }