/// <summary> /// Display notification /// </summary> /// <param name="type">Notification type</param> /// <param name="message">the Message</param> /// <param name="persistForTheNextRequest">A value indicating whether a message should be persisted for the next request</param> /// <param name="saveInSession">if set to <c>true</c> [save in session].</param> protected virtual void AddNotification(Enums.NotifyType type, string message, bool persistForTheNextRequest, bool saveInSession) { var dataKey = string.Format("tmp.notifications.{0}", type); if (!saveInSession) { if (persistForTheNextRequest) { if (TempData[dataKey] == null) { TempData[dataKey] = new List <string>(); } ((List <string>)TempData[dataKey]).Add(message); } else { if (ViewData[dataKey] == null) { ViewData[dataKey] = new List <string>(); } ((List <string>)ViewData[dataKey]).Add(message); } } else { if (Session[dataKey] == null) { Session[dataKey] = new List <string>(); } ((List <string>)Session[dataKey]).Add(message); } }
public NotificationMessage(string msg, Enums.NotifyType errorType) { Message = msg; Type = errorType; }
protected virtual object GetJson(string message, Enums.NotifyType notifyType) { return(new { IsError = notifyType, Message = message }); }