Created
July 21, 2014 17:56
-
-
Save mgroves/0252d966ecf23db56060 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
| public class AjaxController : Controller | |
| { | |
| readonly IDatabase _db; | |
| public AjaxController(IDatabase db) | |
| { | |
| _db = db; | |
| } | |
| // ... snip ... | |
| [HttpGet] | |
| public PartialViewResult GetLedgerEditRow(int id) | |
| { | |
| var ledger = _db.Query(new GetLedgerByIdQuery(id)); | |
| return PartialView(ledger); | |
| } | |
| } |
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
| public class AjaxController : Controller | |
| { | |
| readonly IDatabase _db; | |
| public AjaxController(IDatabase db) | |
| { | |
| _db = db; | |
| } | |
| // ... snip ... | |
| [HttpPost] | |
| public ActionResult CreateLedger(LedgerEntity ledger) | |
| { | |
| if (ModelState.IsValid) | |
| { | |
| _db.Execute(new CreateLedgerCommand(ledger)); | |
| return new HttpStatusCodeResult(HttpStatusCode.Created, "it worked"); | |
| } | |
| return new HttpStatusCodeResult(HttpStatusCode.InternalServerError, "Errors"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment