示例#1
0
        public GetContentTypeResponse Get(Guid id)
        {
            IContentTypeRepository repo      = IoC.Container.Resolve <IContentTypeRepository>();
            GetContentTypeResponse response  = repo.GetById <GetContentTypeResponse>(id.ToString());
            IParameterRepository   paramRepo = IoC.Container.Resolve <IParameterRepository>();

            response.Parameters = paramRepo.GetByParentId(id, ParameterParentType.ContentType);
            return(response);
        }
示例#2
0
        public IResponseData <GetContentTypeResponse> GetContentType(Guid id)
        {
            IResponseData <GetContentTypeResponse> response = new ResponseData <GetContentTypeResponse>();

            try
            {
                IContentTypeService    service = IoC.Container.Resolve <IContentTypeService>();
                GetContentTypeResponse item    = service.Get(id);
                response.SetData(item);
            }
            catch (ValidationException ex)
            {
                response.SetErrors(ex.Errors);
                response.SetStatus(HttpStatusCode.PreconditionFailed);
            }
            return(response);
        }