Updates to PR based on Review

This commit is contained in:
Niels Hartvig
2017-01-10 12:47:00 +01:00
parent 1a9f336a59
commit f75e0cf4ba
3 changed files with 8 additions and 8 deletions

View File

@@ -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,

View File

@@ -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>();

View File

@@ -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;