-
-
Save thecodejunkie/898082 to your computer and use it in GitHub Desktop.
=)
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
// -- BEFORE -- | |
Post["/create"] = x => | |
{ | |
var be = new BeerEvent() | |
{ | |
Name = Request.Form.Name, | |
Location = Request.Form.Location, | |
EventDate = Request.Form.EventDate | |
}; | |
var res = DB.BeerEvents.Insert(be); | |
return RedirectToBeerEvent(res.Id); | |
}; | |
Post["/update/{Id}"] = x => | |
{ | |
var be = new BeerEvent | |
{ | |
Id = x.Id, | |
Name = Request.Form.Name, | |
Location = Request.Form.Location, | |
EventDate = Request.Form.EventDate | |
}; | |
DB.BeerEvents.Update(be); | |
return RedirectToBeerEvent(be.Id); | |
}; | |
// -- AFTER -- | |
Post["/create"] = x => | |
{ | |
BeerEvent be = this.Bind(); | |
var res = DB.BeerEvents.Insert(be); | |
return RedirectToBeerEvent(res.Id); | |
}; | |
Post["/update/{Id}"] = x => | |
{ | |
BeerEvent be = this.Bind("id"); | |
be.Id = x.Id; | |
DB.BeerEvents.Update(be); | |
return RedirectToBeerEvent(be.Id); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment