public override Result Apply(IEnumerable <int> ids)
        {
            var query  = _quizCategoryRepository.AsNoTracking.Where(q => ids.Contains(q.Id));
            var result = new Result().SetSuccess(string.Format(Messages.RecordActivate, query.Count()));

            foreach (var entity in query)
            {
                entity.IsActive = true;
                _quizCategoryRepository.Update(entity);
            }

            _unitOfWork.Commit();
            QuizCategoryCacheManager.ClearCache();

            return(result);
        }
        public Result Edit(int id, QuizCategoryEditAdminDto dto)
        {
            dto.Id = id;
            var result = _validatorEdit.ValidateResult(dto);

            if (!result.Success)
            {
                return(result);
            }

            if (dto.Id > 0)
            {
                var entity = _quizCategoryRepository.AsNoTracking.FirstOrDefault(w => w.Id == dto.Id);

                if (entity == null)
                {
                    return(result.SetError("There are error for update record. Please try again with refresh."));
                }

                Mapper.Map <QuizCategory>(dto, entity);
                _quizCategoryRepository.Update(entity);

                _unitOfWork.Commit();

                result.Id = entity.Id;
            }
            else
            {
                var entity = Mapper.Map <QuizCategory>(dto);
                _quizCategoryRepository.Insert(entity);
                _unitOfWork.Commit();

                result.Id = entity.Id;
            }

            QuizCategoryCacheManager.ClearCache();

            return(result.SetSuccess(Messages.RecordSaved));
        }