Ejemplo n.º 1
0
        public async Task <bool> CreateAsync(TEntity obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException();
            }
            Contract.EndContractBlock();

            var result = await _entityCreator.CreateAsync(obj);

            if (!result)
            {
                _entityCreator.ResolveErrors(_validationErrors, exception => ExceptionMessage = exception);
            }
            return(result);
        }
        public virtual async Task <bool> CreateAsync(TEntity obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException();
            }
            Contract.EndContractBlock();

            if (_entityWithIncludesProvider == null)
            {
                throw new NullReferenceException("Entity creator is null. Make sure it is injected in constructor.");
            }
            var result = await _entityCreator.CreateAsync(obj);

            if (!result)
            {
                _entityCreator.ResolveErrors(_validationErrors, exception => ExceptionMessage = exception);
            }
            return(result);
        }