示例#1
0
        public ActionResult EditGalleryPanel(FormCollection collection, IEnumerable <HttpPostedFileBase> files)
        {
            if (System.Web.HttpContext.Current.Session["admin"] != null && System.Web.HttpContext.Current.Session["admin"].ToString() == "iamadmin" && files != null && collection != null)
            {
                var pm     = new PanelManagement();
                var thisId = Convert.ToInt32(collection["thisID"], CultureInfo.CurrentCulture);
                switch (collection["submit"])
                {
                case "save":
                    var styleSheet   = Convert.ToInt32(collection["panelDesign"], CultureInfo.CurrentCulture);
                    var header       = collection["hdr"];
                    var menuTag      = collection["menuTag"];
                    var underMenuTag = collection["underMenuTag"];

                    pm.EditGalleryPanel(thisId, styleSheet, header, menuTag, underMenuTag);
                    foreach (var item in files)
                    {
                        if (item != null)
                        {
                            if (HttpPostedFileBaseExtensions.IsImage(item))
                            {
                                pm.AddGalleryImage(thisId, item);
                            }
                        }
                    }

                    this.rc.ClearPanelCache();
                    return(this.Redirect(this.Request.UrlReferrer.ToString()));

                case "cancel":
                    return(this.RedirectToAction("AdminHome", "Admin"));

                case "delete":
                    pm.DeletePanel(thisId);

                    this.rc.ClearPanelCache();
                    return(this.RedirectToAction("AdminHome", "Admin"));

                default:
                    throw new ArgumentNullException("collection");
                }
            }
            else
            {
                return(this.RedirectToAction("AdminLogOn", "Admin"));
            }
        }
示例#2
0
        public ActionResult EditVideoPanel(FormCollection collection)
        {
            if (System.Web.HttpContext.Current.Session["admin"] != null && System.Web.HttpContext.Current.Session["admin"].ToString() == "iamadmin")
            {
                var pm = new PanelManagement();
                if (collection != null)
                {
                    var thisId = Convert.ToInt32(collection["thisID"], CultureInfo.CurrentCulture);
                    switch (collection["submit"])
                    {
                    case "save":
                        var menuTag      = collection["menuTag"];
                        var undermenutag = collection["underMenuTag"];
                        var styleSheet   = Convert.ToInt32(collection["panelDesign"], CultureInfo.CurrentCulture);
                        var header       = collection["hdr"];
                        var url          = collection["videoURL"];

                        pm.EditVideoPanel(thisId, menuTag, undermenutag, styleSheet, url, header);

                        this.rc.ClearPanelCache();
                        return(this.RedirectToAction("AdminHome", "Admin"));

                    case "cancel":
                        return(this.RedirectToAction("AdminHome", "Admin"));

                    case "delete":
                        pm.DeletePanel(thisId);

                        this.rc.ClearPanelCache();
                        return(this.RedirectToAction("AdminHome", "Admin"));

                    default:
                        throw new ArgumentNullException("collection");
                    }
                }
                else
                {
                    throw new ArgumentNullException("collection");
                }
            }
            else
            {
                return(this.RedirectToAction("AdminLogOn", "Admin"));
            }
        }