Created
October 29, 2019 18:31
Code Mania 2019: Property Lottery
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
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