Beispiel #1
0
        public int Save(ContentBinding Model)
        {
            using (var _c = db)
            {
                var _Model = new ContentProperty();
                if (Model.ContentPropertyID == 0)
                {
                    var _IQParent = _c.ContentProperties.Where(m => m.SiteID == Model.SiteID && m.ContentPropertyParentID == Model.ContentPropertyParentID);
                    _Model.ContentPropertyParentID = Model.ContentPropertyParentID;
                    _Model.SiteID   = Model.SiteID;
                    _Model.Priority = _IQParent.Any() ? _IQParent.Select(m => m.Priority).Max() + 1 : 0;
                    _Model.Lock     = Model.Lock;
                    _Model.Enabled  = true;
                    _c.ContentProperties.Add(_Model);
                }
                else
                {
                    _Model          = _c.ContentProperties.Where(m => m.ContentPropertyID == Model.ContentPropertyID).SingleOrDefault();
                    _Model.Priority = Model.Priority;
                }
                _Model.ContentPropertyAlias = Model.ContentPropertyAlias;
                _Model.ContentPropertyType  = Model.ContentPropertyType;
                _c.SaveChanges();

                //SAVE ROOT
                AddRoot(_Model.ContentPropertyID, _Model.ContentPropertyParentID);

                return(_Model.ContentPropertyID);
            }
        }
Beispiel #2
0
 public int Save(ContentBinding Model, string UserID)
 {
     using (var _c = db)
     {
         Can(Model.SiteID, UserID, _c);
         return(Save(Model));
     }
 }
Beispiel #3
0
 public void SaveAlias(ContentBinding Model, string UserID)
 {
     using (var _c = db)
     {
         var _CP = _c.ContentProperties.Where(m => m.ContentPropertyID == Model.ContentPropertyID).SingleOrDefault();
         Can(_CP.SiteID, UserID, _c);
         var _Content = _c.ContentProperties.Where(m => m.ContentPropertyID == Model.ContentPropertyID).SingleOrDefault();
         _Content.ContentPropertyAlias = Model.ContentPropertyAlias;
         _c.SaveChanges();
     }
 }
Beispiel #4
0
 public ContentBindingList Duplicate(ContentBinding Model, string UserID)
 {
     using (var _c = db)
     {
         Can(Model.SiteID, UserID, _c);
         int _ParentID = _c.ContentProperties.Where(m => m.ContentPropertyID == Model.ContentPropertyID).Select(m => m.ContentPropertyParentID).SingleOrDefault();
         int _CPID     = Duplicate(Model.ContentPropertyID, _ParentID, false);
         var _Model    = new List <ContentProperty>();
         _Model.Add(_c.ContentProperties.Where(m => m.ContentPropertyID == _CPID).SingleOrDefault());
         return(GetOrder(_Model, _ParentID)[0]);
     }
 }
Beispiel #5
0
        public int Save(PageBinding Model, bool CreateContent = true)
        {
            using (var _c = db)
            {
                var _IQParent = _c.Pages.Where(m => m.SiteID == Model.SiteID && m.PageParentID == Model.PageParentID);
                var _Model    = new Page();
                _Model.PageParentID = Model.PageParentID;
                _Model.Alias        = Model.Alias;
                _Model.SiteID       = Model.SiteID;
                _Model.Priority     = _IQParent.Any() ? _IQParent.Select(m => m.Priority).Max() + 1 : 0;
                _Model.InMenu       = Model.InMenu;
                _c.Pages.Add(_Model);
                _c.SaveChanges();

                if (CreateContent)
                {
                    if (_Model.PageParentID == 0)
                    {
                        //CRETING CONTENT LIST
                        var _Content = new ContentBinding
                        {
                            ContentPropertyAlias = Model.Alias,
                            //ContentPropertyParentID = (_c.Pages.Where(m => m.PageID == Model.PageParentID).Any()
                            //? _c.ContentPropertyCultures.Where(m => m.ContentProperty.SiteID == Model.SiteID && m.ContentProperty.ContentPropertyAlias.Equals(_c.Pages.Where(m2 => m2.PageID == Model.PageParentID).FirstOrDefault().Alias)).FirstOrDefault().ContentProperty.ContentPropertyID
                            //: 0),
                            ContentPropertyParentID = 0,
                            SiteID = Model.SiteID,
                            Lock   = false,
                            ContentPropertyType = ContentPropertyType.LIST,
                        };
                        new ContentBLL().Save(_Content);
                    }
                }
                return(_Model.PageID);
            }
        }
Beispiel #6
0
 public ContentBindingList Duplicate(ContentBinding Model, string UserID)
 {
     using (var _c = db)
     {
         Can(Model.SiteID, UserID, _c);
         int _ParentID = _c.ContentProperties.Where(m => m.ContentPropertyID == Model.ContentPropertyID).Select(m => m.ContentPropertyParentID).SingleOrDefault();
         int _CPID = Duplicate(Model.ContentPropertyID, _ParentID, false);
         var _Model = new List<ContentProperty>();
         _Model.Add(_c.ContentProperties.Where(m => m.ContentPropertyID == _CPID).SingleOrDefault());
         return GetOrder(_Model, _ParentID)[0];
     }
 }
Beispiel #7
0
 public void SaveAlias(ContentBinding Model, string UserID)
 {
     using (var _c = db)
     {
         var _CP = _c.ContentProperties.Where(m => m.ContentPropertyID == Model.ContentPropertyID).SingleOrDefault();
         Can(_CP.SiteID, UserID, _c);
         var _Content = _c.ContentProperties.Where(m => m.ContentPropertyID == Model.ContentPropertyID).SingleOrDefault();
         _Content.ContentPropertyAlias = Model.ContentPropertyAlias;
         _c.SaveChanges();
     }
 }
Beispiel #8
0
 public int Save(ContentBinding Model, string UserID)
 {
     using (var _c = db)
     {
         Can(Model.SiteID, UserID, _c);
         return Save(Model);
     }
 }
Beispiel #9
0
        public int Save(ContentBinding Model)
        {
            using (var _c = db)
            {
                var _Model = new ContentProperty();
                if (Model.ContentPropertyID == 0)
                {
                    var _IQParent = _c.ContentProperties.Where(m => m.SiteID == Model.SiteID && m.ContentPropertyParentID == Model.ContentPropertyParentID);
                    _Model.ContentPropertyParentID = Model.ContentPropertyParentID;
                    _Model.SiteID = Model.SiteID;
                    _Model.Priority = _IQParent.Any() ? _IQParent.Select(m => m.Priority).Max() + 1 : 0;
                    _Model.Lock = Model.Lock;
                    _Model.Enabled = true;
                    _c.ContentProperties.Add(_Model);
                }
                else
                {
                    _Model = _c.ContentProperties.Where(m => m.ContentPropertyID == Model.ContentPropertyID).SingleOrDefault();
                    _Model.Priority = Model.Priority;
                }
                _Model.ContentPropertyAlias = Model.ContentPropertyAlias;
                _Model.ContentPropertyType = Model.ContentPropertyType;
                _c.SaveChanges();

                //SAVE ROOT
                AddRoot(_Model.ContentPropertyID, _Model.ContentPropertyParentID);

                return _Model.ContentPropertyID;
            }
        }
Beispiel #10
0
 public IHttpActionResult Duplicate(ContentBinding Model)
 {
     return(Ok(_ContentService.Duplicate(Model, User.Identity.GetUserId())));
 }
 public IHttpActionResult Duplicate(ContentBinding Model)
 {
     return Ok(_ContentService.Duplicate(Model, User.Identity.GetUserId()));
 }
Beispiel #12
0
        public int Save(PageBinding Model, bool CreateContent = true)
        {
            using (var _c = db)
            {
                var _IQParent = _c.Pages.Where(m => m.SiteID == Model.SiteID && m.PageParentID == Model.PageParentID);
                var _Model = new Page();
                _Model.PageParentID = Model.PageParentID;
                _Model.Alias = Model.Alias;
                _Model.SiteID = Model.SiteID;
                _Model.Priority = _IQParent.Any() ? _IQParent.Select(m => m.Priority).Max() + 1 : 0;
                _Model.InMenu = Model.InMenu;
                _c.Pages.Add(_Model);
                _c.SaveChanges();

                if (CreateContent)
                {
                    if (_Model.PageParentID == 0)
                    {
                        //CRETING CONTENT LIST
                        var _Content = new ContentBinding
                        {
                            ContentPropertyAlias = Model.Alias,
                            //ContentPropertyParentID = (_c.Pages.Where(m => m.PageID == Model.PageParentID).Any()
                            //? _c.ContentPropertyCultures.Where(m => m.ContentProperty.SiteID == Model.SiteID && m.ContentProperty.ContentPropertyAlias.Equals(_c.Pages.Where(m2 => m2.PageID == Model.PageParentID).FirstOrDefault().Alias)).FirstOrDefault().ContentProperty.ContentPropertyID
                            //: 0),
                            ContentPropertyParentID = 0,
                            SiteID = Model.SiteID,
                            Lock = false,
                            ContentPropertyType = ContentPropertyType.LIST,
                        };
                        new ContentBLL().Save(_Content);
                    }
                }
                return _Model.PageID;
            }
        }