示例#1
0
        public ToastMessage AddToastMessage(string title, string message, StayHealthy.Common.Enums.SystemEnum.ToastType toastType)
        {
            var toast = new ToastMessage()
            {
                Title     = title,
                Message   = message,
                ToastType = toastType
            };

            ToastMessages.Add(toast);
            return(toast);
        }
        public static ToastMessage AddToastMessage(this Controller controller, string title, string message, StayHealthy.Common.Enums.SystemEnum.ToastType toastType = StayHealthy.Common.Enums.SystemEnum.ToastType.Info)
        {
            Toastr toastr = controller.TempData["Toastr"] as Toastr;

            toastr = toastr ?? new Toastr();

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

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