Esempio n. 1
0
        public async Task <IdentityResult> SaveChangesAsync(CancellationToken cancellationToken)
        {
            try
            {
                await _context.SaveChangesAsync(cancellationToken);

                return(IdentityResult.Succeeded());
            }
            catch (DbEntityValidationException ex)
            {
                return
                    (IdentityResult.Failed(
                         ex.EntityValidationErrors.SelectMany(ve => ve.ValidationErrors.Select(e => e.ErrorMessage))
                         .ToArray()));
            }
        }