public async Task<bool> UpdateAsync(User user) { using (var db = new UserContext()) { var result = await db.Users.SingleOrDefaultAsync(e => e.UserId == user.UserId); if (result != null) { result.Name = user.Name; await db.SaveChangesAsync(); return true; } return false; } }
public async Task <bool> UpdateAsync(User user) { using (var db = new UserContext()) { var result = await db.Users.SingleOrDefaultAsync(e => e.UserId == user.UserId); if (result != null) { result.Name = user.Name; await db.SaveChangesAsync(); return(true); } return(false); } }