protected override IEnumerable <Pattern> Execute(SqlDataReader reader) { CheckFor.StoredProcedure.Execute(reader); var result = new List <Pattern>(); while (reader.Read()) { var designerKey = DesignerKey.Parse(reader.GetStringUnsafe("designer")); var patternId = new PatternId(designerKey, reader.GetStringUnsafe("reference")); var version = reader.GetStringUnsafe("version"); var pattern = new Pattern(patternId, version) { CategoryKey = reader.GetStringUnsafe("category"), CreationTime = reader.GetDateTimeUnsafe("creation_time"), HasPreview = reader.GetBooleanUnsafe("preview"), LastModifiedTime = reader.GetDateTimeUnsafe("last_modified_time"), Preferred = true, Published = true, Showcased = true, }; result.Add(pattern); } return(result); }
protected override IEnumerable <Designer> Execute(SqlDataReader reader) { CheckFor.StoredProcedure.Execute(reader); var designers = new List <Designer>(); while (reader.Read()) { var designerKey = DesignerKey.Parse(reader.GetStringUnsafe("id")); var designer = new Designer(designerKey) { AvatarCategory = reader.GetStringUnsafe("avatar_category"), AvatarReference = reader.GetStringUnsafe("avatar_reference"), AvatarVersion = reader.GetStringUnsafe("avatar_version"), Email = reader.GetStringUnsafe("email_address"), FirstName = reader.GetStringUnsafe("firstname"), LastName = reader.GetStringUnsafe("lastname"), Nickname = reader.MayGetStringUnsafe("nickname"), Presentation = reader.GetStringUnsafe("presentation"), WebSiteUrl = reader.MayGetStringUnsafe("website").Select(_ => new Uri(_)), }; designers.Add(designer); } return(designers); }
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { Require.NotNull(controllerContext, "controllerContext"); var value = controllerContext.RouteData.Values["designerKey"]; if (value == null) { return(null); } return(DesignerKey.Parse((string)value)); }