internal static Response AlertsToViewBag(NancyContext context) { var result = context.GetAuthenticationResult(); if (result != null) { if (!String.IsNullOrEmpty(result.Message)) { if (result.Success) { context.Request.AddAlertMessage("success", result.Message); } else { context.Request.AddAlertMessage("error", result.Message); } } } var item = context.Request.Session.GetSessionValue<AlertMessageStore>(AlertMessageStore.AlertMessageKey); context.ViewBag.Alerts = item; return null; }