Class NegotiatedResult

Returns a content negotiated result based on the Accept header. Minimal implementation that works with JSON and XML content, can also optionally return a view with HTML.

System.Object
  System.Web.Mvc.ActionResult
    Westwind.Web.Mvc.NegotiatedResult
public class NegotiatedResult : ActionResult

Class Members

MemberDescription

Constructor

Pass in data to serialize

ExecuteResult

public virtual void ExecuteResult(ControllerContext context)

Data

Data stored to be 'serialized'. Public so it's potentially accessible in filters.

DefaultContentType

FormatOutput

Global static flag that allows you to set whether output is formatted. By default Debug settings of project are used - debug is formatted

ViewName

Optional name of the HTML view to be rendered for HTML responses

Example

// model data only
public ActionResult GetCustomers()
{
     return new NegotiatedResult(repo.Customers.OrderBy( c=> c.Company) )
}
// optional view for HTML
public ActionResult GetCustomers()
{
     return new NegotiatedResult("List", repo.Customers.OrderBy( c=> c.Company) )
}

Requirements

Namespace: Westwind.Web.Mvc
Assembly: westwind.web.mvc.dll

© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic