Correcting a few methods in the DataTypeService.
Adding publish = false in save methods, to ensure that Published isn't set to true.
This commit is contained in:
@@ -36,8 +36,7 @@ namespace Umbraco.Core.Models
|
||||
/// Gets or sets the path
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
string Path //Setting this value should be handled by the class not the user
|
||||
{ get; set; }
|
||||
string Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id of the user who created this entity
|
||||
|
||||
@@ -470,7 +470,7 @@ namespace Umbraco.Core.Services
|
||||
var repository = RepositoryResolver.ResolveByType<IContentRepository, IContent, int>(_unitOfWork);
|
||||
|
||||
SetWriter(content, userId);
|
||||
|
||||
content.ChangePublishedState(false);
|
||||
repository.AddOrUpdate(content);
|
||||
_unitOfWork.Commit();
|
||||
|
||||
@@ -503,9 +503,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
foreach (var content in contents)
|
||||
{
|
||||
|
||||
|
||||
SetWriter(content, userId);
|
||||
content.ChangePublishedState(false);
|
||||
repository.AddOrUpdate(content);
|
||||
_unitOfWork.Commit();
|
||||
}
|
||||
@@ -550,6 +549,7 @@ namespace Umbraco.Core.Services
|
||||
foreach (var content in contents)
|
||||
{
|
||||
SetWriter(content.Value, userId);
|
||||
content.Value.ChangePublishedState(false);
|
||||
repository.AddOrUpdate(content.Value);
|
||||
_unitOfWork.Commit();
|
||||
}
|
||||
|
||||
@@ -37,19 +37,34 @@ namespace Umbraco.Core.Services
|
||||
return repository.Get(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="IDataTypeDefinition"/> by its unique guid Id
|
||||
/// </summary>
|
||||
/// <param name="id">Unique guid Id of the DataType</param>
|
||||
/// <returns><see cref="IDataTypeDefinition"/></returns>
|
||||
public IDataTypeDefinition GetDataTypeDefinitionById(Guid id)
|
||||
{
|
||||
var repository = RepositoryResolver.ResolveByType<IDataTypeDefinitionRepository, IDataTypeDefinition, int>(_unitOfWork);
|
||||
|
||||
var query = Query<IDataTypeDefinition>.Builder.Where(x => x.Key == id);
|
||||
var definitions = repository.GetByQuery(query);
|
||||
|
||||
return definitions.FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="IDataTypeDefinition"/> by its control Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the DataType control</param>
|
||||
/// <returns><see cref="IDataTypeDefinition"/></returns>
|
||||
public IDataTypeDefinition GetDataTypeDefinitionById(Guid id)
|
||||
/// <returns>Collection of <see cref="IDataTypeDefinition"/> objects with a matching contorl id</returns>
|
||||
public IEnumerable<IDataTypeDefinition> GetDataTypeDefinitionByControlId(Guid id)
|
||||
{
|
||||
var repository = RepositoryResolver.ResolveByType<IDataTypeDefinitionRepository, IDataTypeDefinition, int>(_unitOfWork);
|
||||
|
||||
var query = Query<IDataTypeDefinition>.Builder.Where(x => x.ControlId == id);
|
||||
var definitions = repository.GetByQuery(query);
|
||||
|
||||
return definitions.FirstOrDefault();
|
||||
return definitions;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -18,9 +18,9 @@ namespace Umbraco.Core.Services
|
||||
IDataTypeDefinition GetDataTypeDefinitionById(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="IDataTypeDefinition"/> by its control Id
|
||||
/// Gets a <see cref="IDataTypeDefinition"/> by its unique guid Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the DataType control</param>
|
||||
/// <param name="id">Unique guid Id of the DataType</param>
|
||||
/// <returns><see cref="IDataTypeDefinition"/></returns>
|
||||
IDataTypeDefinition GetDataTypeDefinitionById(Guid id);
|
||||
|
||||
@@ -61,5 +61,12 @@ namespace Umbraco.Core.Services
|
||||
/// </summary>
|
||||
/// <returns>An enumerable list of <see cref="IDataType"/> objects</returns>
|
||||
IEnumerable<IDataType> GetAllDataTypes();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="IDataTypeDefinition"/> by its control Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the DataType control</param>
|
||||
/// <returns><see cref="IDataTypeDefinition"/></returns>
|
||||
IEnumerable<IDataTypeDefinition> GetDataTypeDefinitionByControlId(Guid id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user