Exemplo n.º 1
0
        public string SaveExtendField_POST()
        {
            ExtendFieldDto extend = this.Request.Form.ConvertToEntity <ExtendFieldDto>();
            Result         r      = ServiceCall.Instance.SiteService.SaveExtendField(this.SiteId, extend);

            if (r.ErrCode > 0)
            {
                return(base.ReturnError(r.ErrMsg));
            }
            return(base.ReturnSuccess());
        }
Exemplo n.º 2
0
 public string SaveExtendField_POST()
 {
     try
     {
         ExtendFieldDto extend = ICollectionExtensions.ConvertToEntity <ExtendFieldDto>(this.Request.Form);
         int            result = ServiceCall.Instance.SiteService.SaveExtendField(this.SiteId, extend);
         return(base.ReturnSuccess());
     }
     catch (Exception exc)
     {
         return(base.ReturnError(exc.Message));
     }
 }
Exemplo n.º 3
0
        public IEnumerable <ExtendFieldDto> GetExtendFields(int siteId)
        {
            ISite                      site = this._resp.GetSiteById(siteId);
            ExtendFieldDto             dto;
            IEnumerable <IExtendField> extends = site.Extend.GetAllExtends();

            foreach (IExtendField extend in extends)
            {
                dto    = new ExtendFieldDto().CloneData(extend);
                dto.Id = extend.Id;
                yield return(dto);
            }
        }
Exemplo n.º 4
0
        public int SaveExtendField(int siteId, ExtendFieldDto dto)
        {
            ISite site = this._resp.GetSiteById(siteId);

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

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

            field.CloneData(dto);
            return(site.Extend.SaveExtendField(field));
        }
Exemplo n.º 5
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);
        }