using System.Collections.Generic;
using Nancy.ModelBinding;
public class CustomerModule : NancyModule
Get["/index"] = parameters =>
Post["/add"] = parameters =>{
var test = this.Bind<Test>();
var result = this.Validate<Test>(test);
return RenderErrorView(result);
private string RenderErrorView(ModelValidationResult result)
var url = string.Format("<a href='{0}'>Back to List</a>", this.Context.ToFullPath("~/index"));
e.Value.Select(error => error.ErrorMessage)).ToList();
return "Sorry, but your data is invalid. " + url + "<br/>Errors: <br/>" +
string.Join(", <br/>", errorsDescription);
private List<Uri> GetUris()