Skip to content

Instantly share code, notes, and snippets.

@AThraen
Created October 29, 2019 18:31
Code Mania 2019: Property Lottery
sing EPiServer.Cms.Shell.Extensions;
using EPiServer.Shell.ObjectEditing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace CodeMania.Site.Fun
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple =false)]
public class PropertyLotteryAttribute : Attribute, IMetadataAware
{
public void OnMetadataCreated(ModelMetadata metadata)
{
ExtendedMetadata extendedMetadata = metadata as ExtendedMetadata;
if (extendedMetadata == null) return;
extendedMetadata.ShowForEdit = ((DateTime.Now.Second/10)%2==0) ;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment