Skip to content

Instantly share code, notes, and snippets.

View AndyButland's full-sized avatar

Andy Butland AndyButland

View GitHub Profile
@AndyButland
AndyButland / gist:4ce3836600750b80986e
Created November 4, 2014 15:19
Umbraco redirect to parent with template
public class RedirectNodesWithoutTemplate : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
PublishedContentRequest.Prepared += PublishedContentRequest_Prepared;
base.ApplicationStarted(umbracoApplication, applicationContext);
}
private void PublishedContentRequest_Prepared(object sender, System.EventArgs e)
{
using System.ComponentModel.DataAnnotations;
public class Category
{
private Category()
{
}
public Category(string name)
{
using Microsoft.EntityFrameworkCore;
public class ToDoContext : DbContext
{
public ToDoContext(DbContextOptions<ToDoContext> options)
: base(options)
{
}
public DbSet<Category> Categories { get; set; }
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using MediatR;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
public class TasksEditViewModel
{
using System.Threading.Tasks;
using MediatR;
public class TaskCompleteCommand : IAsyncRequest<CommandResult>
{
public int Id { get; set; }
}
public class TaskCompleteCommandHandler : CommandHandlerBase,
IAsyncRequestHandler<TaskCompleteCommand, CommandResult>
using System.Reflection;
using AutoMapper;
using MediatR;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
public class Startup
using System.Threading.Tasks;
using AutoMapper;
using MediatR;
using Microsoft.AspNetCore.Mvc;
public class TasksController : Controller
{
private readonly IMediator _mediator;
private readonly IMapper _mapper;
private const string NotificationMessageKey = "NotificationMessage";
@Html.ActionLink("Edit", "Edit", "Tasks", new { @class = "edit-link", data_foo = "bar" })
<a asp-controller="Tasks" asp-action="Edit" asp-route-id="@item.Id" class="edit-link" data-foo="bar">Edit</a>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.Bot.Builder.FormFlow;
public class RoomBookingDialog
{
public enum OfficeLocationOptions
{
Bristol = 1,