Пример #1
0
 public IEnumerable <EndpointPart> GetAssociatedEndpoints(ErrorResultPart error)
 {
     return(_contentManager
            .Query <EndpointPart, EndpointPartRecord>(VersionOptions.Latest)
            .Where(record => record.SelectedErrorIds.Contains(error.Id.SerializeId()))
            .List());
 }
Пример #2
0
        public ErrorResult ToViewModel(ErrorResultPart part)
        {
            var tokenState = new Dictionary <string, object> {
                { "Content", part.ContentItem }
            };

            var viewModel = new ErrorResult()
            {
                Code                = part.Code.Value,
                Description         = _tokenizer.Replace(part.As <BodyPart>().Text, tokenState),
                ReasonPhrase        = _tokenizer.Replace(part.ReasonPhrase, tokenState),
                AssociatedEndpoints = GetAssociatedEndpoints(part).Select(ToViewModel)
            };

            return(viewModel);
        }