예제 #1
0
        public ToastMessage AddToastMessage(string title, string message, Enum.ToastrType toastType)
        {
            var toast = new ToastMessage()
            {
                Title     = title,
                Message   = message,
                ToastType = toastType
            };

            ToastMessages.Add(toast);
            return(toast);
        }
예제 #2
0
        public static ToastMessage AddToastMessage(this Controller controller, string title, string message, Enum.ToastrType toastType = Enum.ToastrType.Info)
        {
            var toastr = controller.TempData["Toastr"] as Toastr;

            toastr = toastr ?? new Toastr();

            var toastMessage = toastr.AddToastMessage(title, message, toastType);

            controller.TempData["Toastr"] = toastr;
            return(toastMessage);
        }