C# Class NServiceMVC.Formats.FormatManager

Show file Open project: gregmac/NServiceMVC Class Usage Examples

Public Methods

Method Description
CreateHttpResponse ( string contentType, object model ) : System.Web.Mvc.ActionResult

Creates an ActionResult for the model using the specified contenttype. May return an internal server error if there is a problem encoding, and may return HTTP not acceptable if the content type is unknown.

FormatManager ( NServiceMVC config ) : System
GetContentTypeFromAlias ( string alias ) : string

Attempts to translate a mime-type or shortcut for a mime-type into a real mime-type we can use. Returns the original input if not matched.

TryDeserializeModel ( string input, Type modelType, object &model ) : bool

Private Methods

Method Description
CreateContentResult ( string contentType, object model ) : System.Web.Mvc.ContentResult

Tries to create a content result for the model using the specified contenttype. Returns null if it's not possible to create using the specified type. Normally, you should use CreateHttpResponse.

Method Details

CreateHttpResponse() public method

Creates an ActionResult for the model using the specified contenttype. May return an internal server error if there is a problem encoding, and may return HTTP not acceptable if the content type is unknown.
public CreateHttpResponse ( string contentType, object model ) : System.Web.Mvc.ActionResult
contentType string
model object
return System.Web.Mvc.ActionResult

FormatManager() public method

public FormatManager ( NServiceMVC config ) : System
config NServiceMVC
return System

GetContentTypeFromAlias() public static method

Attempts to translate a mime-type or shortcut for a mime-type into a real mime-type we can use. Returns the original input if not matched.
public static GetContentTypeFromAlias ( string alias ) : string
alias string
return string

TryDeserializeModel() public method

public TryDeserializeModel ( string input, Type modelType, object &model ) : bool
input string
modelType System.Type
model object
return bool