Ejemplo n.º 1
0
        public async Task <PerformanceReview> CreateAsync(PerformanceReview value, Guid employeeId) => await ManagerInvoker.Current.InvokeAsync(this, async() =>
        {
            await value.Validate().Mandatory().RunAsync(throwOnError: true).ConfigureAwait(false);

            value.EmployeeId = employeeId;
            Cleaner.CleanUp(value);
            await value.Validate().Entity().With <IValidator <PerformanceReview> >().RunAsync(throwOnError: true).ConfigureAwait(false);
            return(Cleaner.Clean(await _dataService.CreateAsync(value).ConfigureAwait(false)));
        }, BusinessInvokerArgs.Create).ConfigureAwait(false);
        public Task <PerformanceReview> CreateAsync(PerformanceReview value, Guid employeeId)
        {
            value.Validate(nameof(value)).Mandatory().Run().ThrowOnError();

            return(ManagerInvoker.Current.InvokeAsync(this, async() =>
            {
                ExecutionContext.Current.OperationType = OperationType.Create;
                value.EmployeeId = employeeId;
                Cleaner.CleanUp(value);
                value.Validate(nameof(value)).Entity(PerformanceReviewValidator.Default).Run().ThrowOnError();
                return Cleaner.Clean(await _dataService.CreateAsync(value).ConfigureAwait(false));
            }));
        }