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); }
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); }