Ejemplo n.º 1
0
        public static ReturnObject Delete(HttpContext context, long id)
        {
            if (id <= 0 || id == 1) // id == 1 is to protect the General info section which is special
                return new ReturnObject() { Error = true, Message = "Invalid Section." };

            var item = new Lib.Data.DSQ.Section(id);
            item.Delete();

            return new ReturnObject()
            {
                Growl = new ReturnGrowlObject()
                {
                    Type = "default",
                    Vars = new ReturnGrowlVarsObject()
                    {
                        text = "You have successfully deleted a section.",
                        title = "Section Deleted"
                    }
                },
                Actions = new List<ReturnActionObject>()
                {
                    new ReturnActionObject() {
                        Ele = "#sections-table tr[data-id=\""+id.ToString()+"\"]",
                        Type = "remove"
                    }
                }
            };
        }
Ejemplo n.º 2
0
        public static ReturnObject Edit(HttpContext context, string name, int order, long? id = null)
        {
            var item = new Lib.Data.DSQ.Section(id);
            item.Name = name;
            item.Order = order;
            item.Save();

            return new ReturnObject() { Result = item, Redirect = new ReturnRedirectObject() { Hash = "dev/dsq/sections/list" }, Growl = new ReturnGrowlObject() { Type = "default", Vars = new ReturnGrowlVarsObject() { text = "You have successfully saved this section.", title = "Section Saved" } } };
        }
Ejemplo n.º 3
0
 protected void Page_Init(object sender, EventArgs e)
 {
     string strID = Request.QueryString["id"];
     long id;
     if (string.IsNullOrEmpty(strID) || !long.TryParse(strID, out id))
         item = new Lib.Data.DSQ.Section();
     else
         item = new Lib.Data.DSQ.Section(id);
 }