Пример #1
0
        public async Task <IdentityResult> UpdateAsync(ApplicationUser user, CancellationToken cancellationToken)
        {
            try
            {
                var trackedUser = await _context.Users.FindAsync(user.Id, cancellationToken);

                trackedUser.Email        = user.Email;
                trackedUser.PasswordHash = user.PasswordHash;
                trackedUser.UserName     = user.UserName;

                _context.Entry(trackedUser).State = EntityState.Modified;

                await _context.SaveChangesAsync(cancellationToken);

                return(IdentityResult.Success);
            }
            catch
            {
                return(IdentityResult.Failed());
            }
        }
Пример #2
0
        public void Update(TEntity entity)
        {
            var entityEntry = _context.Entry(entity);

            entityEntry.State = EntityState.Modified;
        }