예제 #1
0
        public async Task <bool> SaveChangesAsync(Employee employee)
        {
            try
            {
                if (employee.Id == 0)
                {
                    await _dbContext.AddAsync(employee);
                }
                else
                {
                    _dbContext.Update(employee);
                }
                await _dbContext.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #2
0
        public async Task <bool> SaveChangesAsync(Comment comment)
        {
            try
            {
                if (comment.Id == 0)
                {
                    await _dbContext.AddAsync(comment);
                }
                else
                {
                    _dbContext.Update(comment);
                }
                await _dbContext.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }