Created
March 4, 2011 22:27
-
-
Save ToJans/855822 to your computer and use it in GitHub Desktop.
How my perfect NancyFx/Simple.Data setup would probably look - I do not know if it is possible to achieve
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Simple.Data; | |
using Nancy; | |
using Org.NerdBeers.Web.Models; | |
namespace Org.NerdBeers.Web.Modules | |
{ | |
public class UtopiaBeerEventModule : NerdBeerModule | |
{ | |
public UtopiaBeerEventModule(): base("/UtopiaBeerEvents") | |
{ | |
Get["/"] = x => View["beerevent_index", DB.BeerEvents | |
.FindAllByEventDateBetween(DateTime.Now,DateTime.Now.AddYears(1)) | |
.OrderByEventDate | |
.Take(10)]; | |
Get["/{Id}"] = x => View["beerevent_detail", DB.BeerEvents.FindById(x.Id)]; | |
Post["/"] = x => Response.AsRedirect("/BeerEvents/{Id}",DB.BeerEvents.Insert(Request.Form)); | |
Put["/{Id}"] = x => Response.AsRedirect("/BeerEvents/{Id}",DB.BeerEvents.Update(Request.Form)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment