public override bool insPhotoAlbum(Guid id, PhotoAlbum ins)
        {
            try
            {
                using (var db = new CMSdb(_context))
                {
                    using (var tran = db.BeginTransaction())
                    {
                        content_photoalbum cdPhotoAlbum = db.content_photoalbums
                                                          .Where(p => p.id == ins.Id)
                                                          .SingleOrDefault();
                        if (cdPhotoAlbum != null)
                        {
                            throw new Exception("Запись с таким Id уже существует");
                        }

                        cdPhotoAlbum = new content_photoalbum
                        {
                            id        = ins.Id,
                            f_site    = _domain,
                            c_path    = ins.Path,
                            c_title   = ins.Title,
                            c_text    = ins.Text,
                            d_date    = ins.Date,
                            c_preview = (ins.PreviewImage != null) ? ins.PreviewImage.Url : null
                        };

                        db.Insert(cdPhotoAlbum);

                        var log = new LogModel()
                        {
                            Site     = _domain,
                            Section  = LogSection.PhotoAlbums,
                            Action   = LogAction.insert,
                            PageId   = ins.Id,
                            PageName = ins.Title,
                            UserId   = _currentUserId,
                            IP       = _ip,
                        };
                        insertLog(log);

                        tran.Commit();
                        return(true);
                    }
                }
            }
            catch
            {
                return(false);
            }
        }
        public override bool updPhotoAlbum(Guid id, PhotoAlbum upd)
        {
            try
            {
                using (var db = new CMSdb(_context))
                {
                    using (var tran = db.BeginTransaction())
                    {
                        content_photoalbum cdPhoto = db.content_photoalbums
                                                     .Where(p => p.id == upd.Id)
                                                     .SingleOrDefault();
                        if (cdPhoto == null)
                        {
                            throw new Exception("Запись с таким Id не найдена");
                        }

                        cdPhoto.c_title   = upd.Title;
                        cdPhoto.c_text    = upd.Text;
                        cdPhoto.d_date    = upd.Date;
                        cdPhoto.c_preview = (upd.PreviewImage == null) ? cdPhoto.c_preview : upd.PreviewImage.Url;
                        db.Update(cdPhoto);

                        var log = new LogModel()
                        {
                            Site     = _domain,
                            Section  = LogSection.PhotoAlbums,
                            Action   = LogAction.update,
                            PageId   = upd.Id,
                            PageName = upd.Title,
                            UserId   = _currentUserId,
                            IP       = _ip,
                        };
                        insertLog(log);

                        tran.Commit();
                        return(true);
                    }
                }
            }
            catch
            {
                return(false);
            }
        }