Example #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.Link( id );
            var question_id = item.QuestionID;
            item.Delete();

            return new ReturnObject() {
                Growl = new ReturnGrowlObject() {
                    Type = "default",
                    Vars = new ReturnGrowlVarsObject() {
                        text = "You have successfully deleted a link.",
                        title = "Link Deleted"
                    }
                },
                Actions = new List<ReturnActionObject>()
                {
                    new ReturnActionObject() {
                        Ele = "#form-q-"+question_id+" tr[data-id=\""+id.ToString()+"\"]",
                        Type = "remove"
                    }
                }
            };
        }