/// <summary>
        /// Spracuje udalost
        /// </summary>
        /// <param name="filterContext">ActionExecutingContext</param>
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var viewData = filterContext.Controller.ViewData;
            var model    = filterContext.ActionParameters["model"];

            if (!viewData.ModelState.IsValid || (model != null && model is IModel && !(model as IModel).Validate()))
            {
                filterContext.Controller.PrintModelStateError();

                //vytvorime zoznam chyb
                List <PairItemBase> errors = new List <PairItemBase>();
                foreach (ModelState modelState in viewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        errors.Add(new ErrorPairItem()
                        {
                            Name  = "model-error",
                            Error = error.ErrorMessage
                        });
                    }
                }

                //vratime result aj s popisom chyb
                filterContext.Result = WebUtility.GetJsonResult(ResponseTypes.ModelIsNotValidError, null, null, errors, JsonRequestBehavior.AllowGet);
            }
            base.OnActionExecuting(filterContext);
        }
 /// <summary>
 /// Spracuje udalost
 /// </summary>
 /// <param name="filterContext">ActionExecutingContext</param>
 public override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     //base authenticate
     if (this.IsBasicAuthenticate)
     {
         if (!this.IsAuthenticated && this.Required)
         {
             //authenticate
             if (!this.InternalBasicAuthenticate(filterContext))
             {
                 filterContext.Result = new HttpBasicUnauthorizedResult();
             }
         }
     }
     else
     {
         //uzivatel nie je prihlaseny pricom prihlasenie je vyzadovane
         if (!this.IsAuthenticated && this.Required)
         {
             if (this.InternalIsPostMethod(filterContext))
             {
                 filterContext.Result = WebUtility.GetJsonResult(ResponseTypes.UserIsNotLogged);
             }
             else
             {
                 if (!String.IsNullOrWhiteSpace(this.RedirectUrl))
                 {
                     filterContext.Result = new RedirectResult(this.RedirectUrl);
                 }
                 else
                 {
                     filterContext.Result = new HttpUnauthorizedResult();
                 }
             }
         }
         //uzivatel je prihlaseny ale je blokovany
         else if (this.IsAuthenticated && this.IsBlocked.HasValue && this.IsBlocked.Value)
         {
             if (this.InternalIsPostMethod(filterContext))
             {
                 filterContext.Result = WebUtility.GetJsonResult(ResponseTypes.UserIsBlocked);
             }
             else
             {
                 if (!String.IsNullOrWhiteSpace(this.RedirectUrl))
                 {
                     filterContext.Result = new RedirectResult(this.RedirectUrl);
                 }
                 else
                 {
                     filterContext.Result = new HttpUnauthorizedResult();
                 }
             }
         }
         //uzivatel je prihlaseny ale nieje blokovany a zaroven je zadana url na redirect
         else if (this.IsAuthenticated && this.IsBlocked.HasValue && !this.Required && !this.IsBlocked.Value && !String.IsNullOrWhiteSpace(this.RedirectUrl))
         {
             if (this.InternalIsPostMethod(filterContext))
             {
                 filterContext.Result = WebUtility.GetJsonResult(ResponseTypes.RedirectToAction, null, this.RedirectUrl);
             }
             else
             {
                 filterContext.Result = new RedirectResult(this.RedirectUrl);
             }
         }
     }
     base.OnActionExecuting(filterContext);
 }
 /// <summary>
 /// Vrati odpoved v definovanom formate
 /// </summary>
 /// <param name="type">Typ odpovede</param>
 /// <param name="message">Sprava vysvetlujuca odpoved</param>
 /// <param name="redirectUrl">Url na ktoru sa ma redirectnut stranka</param>
 /// <param name="data">Data ktore sa odosielaju</param>
 /// <returns>Navratova hodnota pre server</returns>
 public static JsonResult GetJsonResult(ResponseTypes type, String message, String redirectUrl, Object data)
 {
     return(WebUtility.GetJsonResult(type, message, redirectUrl, data, JsonRequestBehavior.DenyGet));
 }
 /// <summary>
 /// Vrati odpoved v definovanom formate
 /// </summary>
 /// <param name="type">Typ odpovede</param>
 /// <param name="message">Sprava vysvetlujuca odpoved</param>
 /// <param name="redirectUrl">Url na ktoru sa ma redirectnut stranka</param>
 /// <param name="behavior">Specifies whether HTTP GET requests from the client are allowed.</param>
 /// <returns>Navratova hodnota pre server</returns>
 public static JsonResult GetJsonResult(ResponseTypes type, String message, String redirectUrl, JsonRequestBehavior behavior)
 {
     return(WebUtility.GetJsonResult(type, message, redirectUrl, null, behavior));
 }
 /// <summary>
 /// Vrati odpoved v definovanom formate
 /// </summary>
 /// <param name="type">Typ odpovede</param>
 /// <param name="message">Sprava vysvetlujuca odpoved</param>
 /// <param name="redirectUrl">Url na ktoru sa ma redirectnut stranka</param>
 /// <returns>Navratova hodnota pre server</returns>
 public static JsonResult GetJsonResult(ResponseTypes type, String message, String redirectUrl)
 {
     return(WebUtility.GetJsonResult(type, message, redirectUrl, null));
 }
 /// <summary>
 /// Vrati odpoved v definovanom formate
 /// </summary>
 /// <param name="type">Typ odpovede</param>
 /// <param name="behavior">Specifies whether HTTP GET requests from the client are allowed.</param>
 /// <returns>Navratova hodnota pre server</returns>
 public static JsonResult GetJsonResult(ResponseTypes type, JsonRequestBehavior behavior)
 {
     return(WebUtility.GetJsonResult(type, null, null, null, behavior));
 }
 /// <summary>
 /// Vrati odpoved v definovanom formate
 /// </summary>
 /// <param name="type">Typ odpovede</param>
 /// <returns>Navratova hodnota pre server</returns>
 public static JsonResult GetJsonResult(ResponseTypes type)
 {
     return(WebUtility.GetJsonResult(type, null, null, null));
 }