Beispiel #1
0
        protected JsonResult Do(WindowAction action)
        {
            if (Actions.OfType <NotificationAction>().Any())
            {
                if (new[] { WindowAction.Refresh, WindowAction.CloseModalRefreshParent }.Contains(action))
                {
                    NotificationAction.ScheduleForNextRequest(Actions);
                }
            }

            return(AddAction(new { BrowserAction = action.ToString() }));
        }
Beispiel #2
0
        public void Do(WindowAction action)
        {
            if (this.OfType <NotificationAction>().Any())
            {
                if (new[] { WindowAction.Refresh, WindowAction.CloseModalRefreshParent }.Contains(action))
                {
                    NotificationAction.ScheduleForNextRequest();
                }
            }

            Add(new { BrowserAction = action.ToString() });
        }
Beispiel #3
0
        public void Redirect(string url, bool withAjax = false, string target = null)
        {
            url = url.Or("#");
            if (!url.OrEmpty().ToLower().StartsWithAny("/", "http:", "https:"))
            {
                url = "/" + url;
            }

            NotificationAction.ScheduleForNextRequest();

            Add(new { Redirect = url, WithAjax = withAjax, Target = target });
        }
Beispiel #4
0
        public ActionResult AjaxRedirect(string url)
        {
            url = url.Or("#");
            if (!url.OrEmpty().ToLower().StartsWithAny("/", "http:", "https:"))
            {
                url = "/" + url;
            }

            if (Actions.OfType <NotificationAction>().Any())
            {
                NotificationAction.ScheduleForNextRequest(Actions);
            }

            Actions.Add(new { Redirect = url, WithAjax = true });

            return(JsonActions());
        }
Beispiel #5
0
        public ActionResult Redirect(string url, string target = null)
        {
            url = url.Or("#");
            if (!url.OrEmpty().ToLower().StartsWithAny("/", "http:", "https:"))
            {
                url = "/" + url;
            }

            if (Actions.OfType <NotificationAction>().Any())
            {
                NotificationAction.ScheduleForNextRequest(Actions);
            }

            if (Request.IsAjaxCall() || target.HasValue())
            {
                Actions.Add(new { Redirect = url, Target = target });

                return(JsonActions());
            }
            else
            {
                return(base.Redirect(url));
            }
        }
Beispiel #6
0
 /// <summary>
 /// Creates a ViewResult object by using the model that renders a view to the response.
 /// </summary>
 protected new internal async Task <ViewResult> View(string viewName, object model)
 {
     AddAction(await NotificationAction.GetScheduledNotification());
     return(base.View(viewName, model));
 }
Beispiel #7
0
 internal void ScheduleNotifications() => Add(NotificationAction.GetScheduledNotification());