Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace NancyConNegDemo
- {
- using Extensions;
- using Models;
- using Nancy;
- public class ConNegModule : NancyModule
- {
- public ConNegModule() : base("/conneg")
- {
- Get["/user/{id}"] = x =>
- {
- var model = database.GetUserById(x.id);
- return I.RespondTo(ContentType.Html).WithView("UserView")
- .RespondTo(ContentType.Json)
- .RespondTo(ContentType.Xml)
- .UsingModel(model)
- .CacheFor(7).Days
- .WithETag(hash);
- };
- Get["/widget/{id}"] = x =>
- {
- var model = database.GetWidgetById(x.id);
- return I.RespondToAll()
- .Except(ContentType.Html)
- .UsingModel(model);
- };
- }
- }
- }
Add Comment
Please, Sign In to add comment