Esempio n. 1
0
 public void Edit(TMto Dto)
 {
     if (_context.Set <TEf>().Any(e => e.Id.Equals((converter.ToEF(Dto).Id))))
     {
         //_context.Set<TEf>().Update(converter.ToEF(Dto));
         _context.Attach(converter.ToEF(Dto)).State = EntityState.Modified;
     }
 }
Esempio n. 2
0
 public async Task <IdentityResult> UpdateAsync(User user, CancellationToken cancellationToken = default(CancellationToken))
 {
     cancellationToken.ThrowIfCancellationRequested();
     ThrowIfDisposed();
     if (user == null)
     {
         throw new ArgumentNullException(nameof(user));
     }
     _context.Attach(user);
     user.ConcurrencyStamp = Guid.NewGuid().ToString();
     _context.Update(user);
     try
     {
         await _context.SaveChangesAsync(cancellationToken);
     }
     catch (DbUpdateConcurrencyException)
     {
         return(IdentityResult.Failed(ErrorDescriber.ConcurrencyFailure()));
     }
     return(IdentityResult.Success);
 }