Exemplo n.º 1
0
        private async Task ValidateIsUnique(AddWebDirectoryCommand command)
        {
            var query = new IsWebDirectoryPathUniqueQuery();

            query.ParentWebDirectoryId = command.ParentWebDirectoryId;
            query.UrlPath = command.UrlPath;

            var isUnique = await _queryExecutor.ExecuteAsync(query);

            if (!isUnique)
            {
                var message = string.Format("A web directory already exists in that parent directory with the path '{0}'", command.UrlPath);
                throw new UniqueConstraintViolationException(message, "UrlPath", command.UrlPath);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Determines if a webdirectory UrlPath is unique
 /// within its parent directory.
 /// </summary>
 /// <param name="query">The parameters run the query with.</param>
 /// <param name="executionContext">Optional execution context to use when executing the query. Useful if you need to temporarily elevate your permission level.</param>
 /// <returns>True if the path is unique; otherwise false.</returns>
 public bool IsRoleTitleUnique(IsWebDirectoryPathUniqueQuery query, IExecutionContext executionContext = null)
 {
     return(_queryExecutor.Execute(query, executionContext));
 }