Skip to content

Instantly share code, notes, and snippets.

View Maarten88's full-sized avatar

Maarten Sikkema Maarten88

View GitHub Profile
@Maarten88
Maarten88 / ContentPageCommands.cs
Last active December 17, 2015 07:48
Simple Queries and Commands for working with Markdown Content
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Auction.Web.Domain.Entities;
using Auction.Web.Domain.Infrastructure;
using SqlFu;
namespace Auction.Web.Domain.Commands
{
@Maarten88
Maarten88 / Markdown.cshtml
Created May 14, 2013 10:17
EditorTemplate for Markdown field using MarkDownDeep.NET
@model object
<link rel="stylesheet" type="text/css" href="/Scripts/mdd_styles.css" />
<div class="control-group@(Html.ValidationErrorFor(m => m, " error"))">
@Html.LabelFor(m => m, new { @class = "control-label" })
<div class="mdd_toolbar"></div>
@Html.TextAreaFor(
m => m,
8, 15,
ViewBag.ClearTextField == true ? new { @class = "mdd_editor clear-text-field" } : new { @class = "mdd_editor" } )
@Html.ValidationMessageFor(m => m, null, new { @class = "help-inline" })
@model Auction.Web.Domain.Models.ContentPage
@{
ViewBag.Title = Model.Title;
ViewBag.Description = Model.Markdown.Substring(0, Math.Min(Model.Markdown.Length - 1, 50));
}
<article class="content-item">
<header>
<h1>@Model.Title</h1>
@Maarten88
Maarten88 / ValidationErrorFor.cs
Created May 28, 2013 11:56
Html Extension to highlight Model errors by setting class="error" on an element
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Web;
using System.Web.Mvc;
namespace Auction.Web.Utility
{
public static class Validation
@model Auction.Web.Models.LoginModel
@{
ViewBag.Title = "Log in";
}
<h1>@ViewBag.Title <small>with local or social network account</small></h1>
<div class="row-fluid">
<div class="span6">
@using (Html.BeginForm(null, null, new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal well" }))
{
@Maarten88
Maarten88 / MembershipMigration.cs
Last active December 17, 2015 20:48
FluentMigrator Migration that creates the schema for WebPages SimpleMembership with OAuth
using System;
using FluentMigrator;
namespace Auction.Web.Domain.Migrations
{
[Migration(2)]
public class UserProfile : Migration
{
public override void Up()
{
@Maarten88
Maarten88 / AdminContentPagesController.cs
Created June 3, 2013 15:47
Controller in the Admin Area for Content Management with markdown. For blog post at http://www.macaw.nl/tags/Cloud%20Auction
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Auction.Web.Controllers;
using Auction.Web.Domain.Commands;
using Auction.Web.Domain.Entities;
using Auction.Web.Domain.Queries;
using Auction.Web.Security;
using Auction.Web.Domain;
using Auction.Service.Contracts;
using Auction.Web.Domain.Commands;
using Auction.Web.Domain.Entities;
using Auction.Web.Domain.Queries;
using Auction.Web.Utility;
using AutoMapper;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
using System;
using Auction.Service.Contracts;
using Auction.Web.Domain;
using Auction.Web.Domain.Events;
using AutoMapper;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Infrastructure;
namespace Auction.Web.Hubs.EventHandlers
{
public class PriceUpdatedHandler : BaseEventHandler<PriceUpdatedEvent>
@{
ViewBag.Title = "SignalR Auction";
}
<div class="row-fluid"">
<div class="page-header">
<h1>
<strong data-bind="text: Title"></strong>
<small data-bind="text: Info"></small>
</h1>