//[4][4] 수정: UpdateAsync
        public async Task <bool> EditAsync(DepartmentModel model)
        {
            try
            {
                //_context.Departments.Attach(model);
                _context.Entry(model).State = EntityState.Modified;
                return(await _context.SaveChangesAsync() > 0 ? true : false);
            }
            catch (Exception e)
            {
                _logger?.LogError($"ERROR({nameof(EditAsync)}): {e.Message}");
            }

            return(false);
        }
        //[4][17] 답변: DepartmentApp
        public async Task <DepartmentModel> AddAsync(DepartmentModel model, int parentId)
        {
            model.CreatedAt = DateTime.UtcNow;

            try
            {
                _context.Departments.Add(model);
                await _context.SaveChangesAsync();
            }
            catch (Exception e)
            {
                _logger?.LogError($"ERROR({nameof(AddAsync)}): {e.Message}");
            }

            return(model);
        }
        public async Task <bool> UpdateAsync(DepartmentModel model)
        {
            try
            {
                var m = _context.Departments.Find(model.Id);

                m.Name   = model.Name;
                m.Active = model.Active;

                _context.Update(m);
                return(await _context.SaveChangesAsync() > 0 ? true : false);
            }
            catch (Exception e)
            {
                _logger?.LogError($"ERROR({nameof(UpdateAsync)}): {e.Message}");
            }

            return(false);
        }