Beispiel #1
0
        /// <summary>
        /// change the section parent
        /// </summary>
        /// <param name="sectionId">identifier of section</param>
        /// <param name="parentId">identifier of parent section</param>
        /// <returns>returns the result to action</returns>
        public JsonResult ChangeParent(int sectionId, int parentId)
        {
            SectionRepository objsection = new SectionRepository(SessionCustom);
            SectionManagement objman     = new SectionManagement(SessionCustom, HttpContext);

            objsection.Entity.SectionId = sectionId;
            objsection.LoadByKey();

            if (parentId != 0)
            {
                objsection.Entity.ParentId = parentId;
            }
            else
            {
                objsection.Entity.ParentId = null;
            }

            objsection.Update();
            objsection.Entity = new Section();

            objman.CreateTreeView(sectionId, objsection.GetAll());

            return(this.Json(new { result = true, html = objman.Tree }));
        }