예제 #1
0
        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;
            }
        }
예제 #2
0
        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);
            }
        }