Example #1
0
        public IEnumerable <ExtendFieldDto> GetExtendFields(int siteId)
        {
            ISite                      site = this.repo.GetSiteById(siteId);
            ExtendFieldDto             dto;
            IEnumerable <IExtendField> extends = site.GetExtendManager().GetAllExtends();

            foreach (IExtendField extend in extends)
            {
                dto    = new ExtendFieldDto().CloneData(extend);
                dto.Id = extend.GetDomainId();
                yield return(dto);
            }
        }
Example #2
0
        public int SaveExtendField(int siteId, ExtendFieldDto dto)
        {
            ISite site = this._resp.GetSiteById(siteId);

            if (site == null)
            {
                throw new Exception("站点不存在");
            }

            IExtendField field = this._extendRep.CreateExtendField(dto.Id, dto.Name);

            field.CloneData(dto);
            return(site.GetExtendManager().SaveExtendField(field));
        }
Example #3
0
        public Result SaveExtendField(int siteId, ExtendFieldDto dto)
        {
            ISite site = this.repo.GetSiteById(siteId);

            if (site == null)
            {
                throw new Exception("站点不存在");
            }

            IExtendField field = this._extendRep.CreateExtendField(dto.Id, dto.Name);

            field.CloneData(dto);
            Error  err = site.GetExtendManager().SaveExtendField(field);
            Result r   = new Result();

            if (err != null)
            {
                r.ErrCode = 1;
                r.ErrMsg  = err.Message;
            }
            return(r);
        }