public JsonResult saveNotification(string notification, int[] Usuarios)
        {
            ModelViewConfiguration model = new JavaScriptSerializer().Deserialize <ModelViewConfiguration>(notification);

            Usuarios = Usuarios.Distinct().ToArray();
            if (model.ConfigurationID == 0)
            {
                if (model.Url == "empty")
                {
                    FacadeConfiguration.InsertURLY(model, Usuarios);
                }
                else
                {
                    if (model.UrlType == "youtube")
                    {
                        FacadeConfiguration.InsertURLY(model, Usuarios);
                    }
                    else if (model.UrlType == "file")
                    {
                        FacadeConfiguration.Insert(Server.MapPath("~/Content/upload/" + model.Url), model, Server.MapPath(GlobalConfiguration.GetLocateNotificationRelative()), Usuarios);
                    }
                }
            }
            else
            {
                if (model.Url == "empty")
                {
                    FacadeConfiguration.UpdateURLY(model, Usuarios);
                }
                else
                {
                    if (model.UrlType == "youtube")
                    {
                        FacadeConfiguration.UpdateURLY(model, Usuarios);
                    }
                    else if (model.UrlType == "file")
                    {
                        FacadeConfiguration.Update(Server.MapPath("~/Content/upload/" + model.Url), model, Server.MapPath(GlobalConfiguration.GetLocateNotificationRelative()), Usuarios);
                    }
                }
            }
            return(Json("{ Result: 'Success'}"));
        }
        public ActionResult SetPublish(string ConfigurationIDs)
        {
            try
            {
                List <int> arr = ConfigurationIDs.Split(',').Select(Int32.Parse).ToList();
                foreach (var x in arr)
                {
                    var        envio = FacadeReceivers.GetAll().Where(p => p.ConfigurationID == x);
                    List <int> noti  = new List <int>();
                    var        confi = FacadeConfiguration.GetListAll().Where(p => p.ConfigurationID == x).FirstOrDefault();
                    confi.Publish = true;
                    ModelViewNotification message = new ModelViewNotification();

                    foreach (var y in envio)
                    {
                        noti.Add(y.UserID);
                        message.Message     = confi.Message;
                        message.Title       = confi.Title;
                        message.Url         = confi.Url;
                        message.UserID      = y.UserID;
                        message.MessageRead = false;
                        FacadeNotification.Insert(message);
                    }

                    FacadeNotification.SendPush(noti, confi.Title, confi.Message);
                    FacadeConfiguration.Update(confi);
                }



                //FacadeAudit.RegisterEntity("/ConfigPromotionTypes/Index", TransactionType.STATUS, "", "", user.IdUser);

                return(Json("Solicitud procesada con éxito", JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                //if (ex.GetType().Name == "Duplicate_Exception") throw ex;
                //if (ex.GetType().Name == "CustomExceptions") throw ex;
                //throw new CustomExceptions(ex, CustomExceptions.ErrorCodes.E_C_Generic);
                throw ex;
            }
        }