public static bool NotifyAction(Models.Log.ActionType action, Object data) { String configValue = ""; if (action == Models.Log.ActionType.ActivateSite) { configValue = "Callbacks:NewActivation"; } else if (action == Models.Log.ActionType.ApproveSite) { configValue = "Callbacks:ActivationApproved"; } else if (action == Models.Log.ActionType.CreateAdjustment) { configValue = "Callbacks:AdjustmentRequested"; } else { return(false); } try { var client = new HttpClient(); client.PostAsync(Startup.Configuration.GetValue <string>(configValue), new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json")); } catch (Exception e) { return(false); } return(true); }
public static bool LogAction(Models.Log.ActionType action, int userId, int modifiedId, String desc) { return(LogAction(action, userId, modifiedId, desc, "")); }
public static bool LogAction(Models.Log.ActionType action, int userId, int modifiedId, String desc, String changes) { return(LogAction(new Models.Log(userId, action, desc, DateTime.UtcNow, modifiedId, changes))); }