Refactoring ChangePublishedState to use an enum instead of a boolean.

This commit is contained in:
Morten Christensen
2013-01-10 14:07:07 -01:00
parent 9974e9b312
commit ca2942fdd9
10 changed files with 40 additions and 23 deletions

View File

@@ -246,14 +246,14 @@ namespace Umbraco.Core.Models
/// <summary>
/// Changes the Published state of the content object
/// </summary>
/// <param name="isPublished">Boolean indicating whether content is published (true) or unpublished (false)</param>
public void ChangePublishedState(bool isPublished)
public void ChangePublishedState(PublishedState state)
{
Published = isPublished;
//NOTE Should this be checked against the Expire/Release dates?
//TODO possibly create new (unpublished version)?
Published = state == PublishedState.Published;
PublishedState = state;
}
internal PublishedState PublishedState { get; set; }
/// <summary>
/// Changes the Trashed state of the content object
/// </summary>
@@ -276,7 +276,7 @@ namespace Umbraco.Core.Models
//If the content is trashed and is published it should be marked as unpublished
if (isTrashed && Published)
{
ChangePublishedState(false);
ChangePublishedState(PublishedState.Unpublished);
}
}

View File

@@ -69,8 +69,7 @@ namespace Umbraco.Core.Models
/// <summary>
/// Changes the Published state of the content object
/// </summary>
/// <param name="isPublished">Boolean indicating whether content is published (true) or unpublished (false)</param>
void ChangePublishedState(bool isPublished);
void ChangePublishedState(PublishedState state);
/// <summary>
/// Changes the Trashed state of the content object

View File

@@ -0,0 +1,9 @@
namespace Umbraco.Core.Models
{
public enum PublishedState
{
Published,
Unpublished,
Saved
}
}