Created
September 17, 2014 04:13
-
-
Save rofr/b4b3e4eababf619cf30b to your computer and use it in GitHub Desktop.
Building a CMS with OrigoDB - snippet 7
This file contains 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
[Serializable] | |
public class RemoveMenuCommand : Command<CmsModel> | |
{ | |
public readonly string MenuName; | |
public RemoveMenuCommand(string menuName) | |
{ | |
MenuName = menuName; | |
} | |
protected override void Execute(CmsModel model) | |
{ | |
try | |
{ | |
model.RemoveMenu(MenuName); | |
} | |
catch (InvalidOperationException) | |
{ | |
throw new CommandFailedException("Cant delete menu, no such name:" + MenuName); | |
} | |
} | |
} | |
[Serializable] | |
public class PutMenuCommand : Command<CmsModel> | |
{ | |
public readonly Menu Menu; | |
public PutMenuCommand(Menu menu) | |
{ | |
if (menu == null) | |
throw new ArgumentNullException("menu"); | |
Menu = menu; | |
} | |
protected override void Execute(CmsModel model) | |
{ | |
model.PutMenu(Menu); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment