public override void ExecuteResult(ControllerContext context) { var resolver = new ControllerActionUrlResolver( new UrlHelper(context.RequestContext), context.HttpContext.Request.Url.Scheme, context.Controller.ControllerContext.RouteData.Values["controller"].ToString()); // Todo add a way to register ILinkFilter var filters = new List<ILinkFilter>(); var untypedLinksResolver = new UnresolvedLinkResolver(resolver, filters); var serializer = new HypermediaTypeSerializer(untypedLinksResolver); var instance = serializer.Serialize(_resource); var response = context.HttpContext.Response; response.ContentType = _resource.MediaType; response.Write(instance.ToString()); }
public override void ExecuteResult(ControllerContext context) { var resolver = new ControllerActionUrlResolver( new UrlHelper(context.RequestContext), context.HttpContext.Request.Url.Scheme, context.Controller.ControllerContext.RouteData.Values["controller"].ToString()); // Todo add a way to register ILinkFilter var filters = new List <ILinkFilter>(); var untypedLinksResolver = new UnresolvedLinkResolver(resolver, filters); var serializer = new HypermediaTypeSerializer(untypedLinksResolver); var instance = serializer.Serialize(_resource); var response = context.HttpContext.Response; response.ContentType = _resource.MediaType; response.Write(instance.ToString()); }