public static void AddMessage(NotificationMessage msg) { List<NotificationMessage> messages = NotificationMessages; if (messages == null) { messages = new List<NotificationMessage>(); } messages.Add(msg); HttpContext.Current.Session[KEY_NOTIFICATION_MESSAGES] = messages; }
private void TryUpdateOrShowMessage(NotificationMessage msg) { try { this.context.SaveChanges(); ErrorSuccessNotifier.AddMessage(msg); } catch (Exception) { ErrorSuccessNotifier.AddMessage(new NotificationMessage() { Text = "Unhandled exception: something bad happened.", AutoHide = false, Type = MessageType.Error }); } }