public static void ToUpdateLog <T>(T model, int historyId) { SynergyResponse response = model as SynergyResponse; if (response != null) { UpdateHistory(historyId, response); } }
private static void UpdateHistory(int historyId, SynergyResponse response) { using (var context = new SynergyDbContext()) { var history = context.Synergy_ApiHistory.Where(x => x.Id == historyId && x.IsActive).FirstOrDefault(); if (history != null) { history.Message = string.IsNullOrEmpty(response.Message) ? "Processed successfully." : response.Message; history.Status = response.Status.ToString(); context.SaveChanges(); } } }