Beispiel #1
0
        public ToastrMessage AddToastrMessage(string title, string message, ToastrEnum.Type toastType)
        {
            var toast = new ToastrMessage()
            {
                Title     = title,
                Message   = message,
                ToastType = toastType
            };

            ToastrMessages.Add(toast);
            return(toast);
        }
        public static ToastrMessage AddToastrMessage(this Controller controller, string title, string message, ToastrEnum.Type toastrType = ToastrEnum.Type.Info)
        {
            ToastrOption toastr = controller.TempData["Toastr"] as ToastrOption;

            toastr = toastr ?? new ToastrOption();

            var toastMessage = toastr.AddToastrMessage(title, message, toastrType);

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