public static void AddFlashMessage(this TempDataDictionary dictionary, UserMessage flashMessage) { var messages = (ICollection<UserMessage>)dictionary[FlashMessageKey]; if (messages == null) { messages = new List<UserMessage>(); dictionary[FlashMessageKey] = messages; } messages.Add(flashMessage); }
protected void AddUserMessage(UserMessage message) { TempData.AddFlashMessage(message); }