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
[HttpPost] | |
[ModelStateToTempData] | |
public ActionResult CreateCustomer(CustomerEditModel customerEditModel) | |
{ | |
if (ModelState.IsValid) | |
{ | |
//Do Something Worthy of your NEW Customer | |
return RedirectToAction("Success"); | |
} | |
return RedirectToAction("FixErrors"); |
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
[HttpPost] | |
[ModelStateToTempData] | |
[PassParametersDuringRedirect] | |
public ActionResult CreateCustomer(CustomerEditModel customerEditModel) | |
{ | |
if (ModelState.IsValid) | |
{ | |
//Do Something Worthy of your NEW Customer | |
return this.RedirectToAction(x => x.Success(customerEditModel)); | |
} |
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
//Source object where depending on the length of the text | |
public class RawRecords | |
{ | |
public int Id { get; set; } | |
public int Sequence { get; set; } | |
public DateTime Timestamp { get; set; } | |
public string Comment { get; set; } | |
} | |
//Destination object where you want the multiple comment lines to be rolled up into the destination CommentText property. |
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
[TestMethod] | |
public void multiple_comment_rollup() | |
{ | |
IEnumerable<RawRecords> rawRecords = GetSampleRows(); | |
const string EXPECTED_COMMENT_42 = "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas."; | |
const string EXPECTED_COMMENT_69 = "Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante."; | |
IEnumerable<Comment> actualComments = | |
from ncr in rawRecords | |
group ncr by new { ncr.Id, ncr.Timestamp } |
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
private static IEnumerable<RawRecords> GetSampleRow() | |
{ | |
var timestamp1 = new DateTime(2010, 3, 12); | |
return new List<RawRecords> | |
{ | |
new RawRecords { Sequence = 4, Id = 42, Timestamp = timestamp1, Comment = "et malesuada fames " }, | |
new RawRecords { Sequence = 1, Id = 42, Timestamp = timestamp1, Comment = "Pellentesque habitant " }, | |
new RawRecords { Sequence = 3, Id = 42, Timestamp = timestamp1, Comment = "senectus et netus " }, | |
new RawRecords { Sequence = 5, Id = 42, Timestamp = timestamp1, Comment = "ac turpis egestas." }, | |
new RawRecords { Sequence = 2, Id = 42, Timestamp = timestamp1, Comment = "morbi tristique " }, |
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
BEGIN TRANSACTION; | |
CREATE TABLE People (Id INTEGER PRIMARY KEY, FirstName varchar(25), LastName varchar(50), JokerRating int); | |
INSERT INTO People VALUES(1,'Chuck','Norris',0); | |
INSERT INTO People VALUES(2,'Clint','Eastwood',0); | |
INSERT INTO People VALUES(3,'Pauly','Shore',1); | |
INSERT INTO People VALUES(4,'Eric','Williams',2); | |
COMMIT; |
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
C:\Users\Eric\code\xizzle [master]> .\build.ps1 | |
psake version 4.00 | |
Copyright (c) 2010 James Kovacs | |
Executing Clean | |
Executing Init | |
Executing Compile | |
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1 | |
Copyright (C) Microsoft Corporation. All rights reserved. |
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
------ Build started: Project: MapR, Configuration: Debug Any CPU ------ | |
Successfully installed 'jQuery 1.6.4'. | |
Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0'. | |
Successfully installed 'SignalR 0.3.5'. | |
Successfully installed 'SignalR.Js 0.3.5'. | |
Successfully installed 'SignalR.Server 0.3.5'. | |
MapR -> C:\Users\Eric\code\MapR\bin\MapR.dll | |
Attempting to build package from 'MapR.csproj'. | |
Packing files from 'C:\Users\Eric\code\MapR\bin'. | |
Found packages.config. Using packages listed as dependencies |
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
Build started 1/14/2012 8:21:18 AM. | |
Project "D:\temp\t1pzp5xx.p3v\input\MapR.sln" on node 1 (default targets). | |
ValidateSolutionConfiguration: | |
Building solution configuration "Release|Any CPU". | |
Project "D:\temp\t1pzp5xx.p3v\input\MapR.sln" (1) is building "D:\temp\t1pzp5xx.p3v\input\MapR.csproj" (2) on node 1 (default targets). | |
RestorePackages: | |
"D:\temp\t1pzp5xx.p3v\input\.nuget\nuget.exe" install "D:\temp\t1pzp5xx.p3v\input\packages.config" -source "" -o "D:\temp\t1pzp5xx.p3v\input\packages" | |
Successfully installed 'jQuery 1.6.4'. | |
Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0'. | |
Successfully installed 'SignalR 0.3.5'. |
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
//Code sample from test: | |
//https://github.com/ServiceStack/ServiceStack.Text/blob/master/tests/ServiceStack.Text.Tests/DynamicModels/GoogleMapsApiTests.cs | |
using System; | |
using System.Collections.Generic; | |
using NUnit.Framework; | |
namespace ServiceStack.Text.Tests.DynamicModels | |
{ | |
public class GoogleMapsApiTests |