public async Task <bool> UpdateBankAccountAsync(BankAccount bankAccount) { try { var excluded = new[] { "ID" }; var entry = _context.Entry(bankAccount); entry.State = EntityState.Modified; foreach (var name in excluded) { entry.Property(name).IsModified = false; } await _context.SaveChangesAsync(); return(true); } catch (Exception) { //Error handle return(false); } }
public async Task <bool> UpdateUserAsync(User user) { try { var excluded = new[] { "Password", "LastLoginDate" }; var entry = _context.Entry(user); entry.State = EntityState.Modified; foreach (var name in excluded) { entry.Property(name).IsModified = false; } await _context.SaveChangesAsync(); return(true); } catch (Exception) { //Error handle return(false); } }