Updates to PR based on Review
This commit is contained in:
@@ -195,7 +195,7 @@ namespace Umbraco.Web.Editors
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new EntityNotFoundException(id, "The passed id doesn't exist");
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
}
|
||||
else if (int.TryParse(id, out idInt))
|
||||
@@ -203,7 +203,7 @@ namespace Umbraco.Web.Editors
|
||||
return getChildren(idInt, pageNumber, pageSize, orderBy, orderDirection, orderBySystemField, filter);
|
||||
}
|
||||
|
||||
throw new InvalidCastException("Id must be either an integer or a Guid");
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
|
||||
private PagedResult<ContentItemBasic<ContentPropertyBasic, IMedia>> getChildren(int id,
|
||||
|
||||
@@ -182,16 +182,16 @@ namespace Umbraco.Web.Editors
|
||||
int idInt;
|
||||
if (Guid.TryParse(contentId, out idGuid)) {
|
||||
var entity = ApplicationContext.Services.EntityService.GetByKey(idGuid);
|
||||
return getAllowedChildren(entity.Id);
|
||||
return GetAllowedChildrenInternal(entity.Id);
|
||||
} else if (int.TryParse(contentId, out idInt))
|
||||
{
|
||||
return getAllowedChildren(idInt);
|
||||
return GetAllowedChildrenInternal(idInt);
|
||||
}
|
||||
|
||||
throw new InvalidCastException("Id must be either an integer or a Guid");
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
|
||||
private IEnumerable<ContentTypeBasic> getAllowedChildren(int contentId)
|
||||
private IEnumerable<ContentTypeBasic> GetAllowedChildrenInternal(int contentId)
|
||||
{
|
||||
if (contentId == Constants.System.RecycleBinContent)
|
||||
return Enumerable.Empty<ContentTypeBasic>();
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace Umbraco.Web.Trees
|
||||
var idEntity = GetEntityFromId(id);
|
||||
if (idEntity == null)
|
||||
{
|
||||
throw new EntityNotFoundException(id, "The passed id doesn't exist");
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
iid = idEntity.Id;
|
||||
}
|
||||
@@ -323,7 +323,7 @@ namespace Umbraco.Web.Trees
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidCastException("Id must be either an integer or a Guid");
|
||||
return null;
|
||||
}
|
||||
|
||||
return entity;
|
||||
|
||||
Reference in New Issue
Block a user