public Result Create(GeneralSettingCreateAdminDto dto)
        {
            var result = _validatorCreate.ValidateResult(dto);

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

            var entity = Mapper.Map <GeneralSetting>(dto);

            _GeneralSettingRepository.Insert(entity);
            _unitOfWork.Commit();

            GeneralSettingCacheManager.ClearCache();
            result.Id = entity.Id;

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

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

            if (dto.Id > 0)
            {
                var entity = _GeneralSettingRepository.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 <GeneralSetting>(dto, entity);
                _GeneralSettingRepository.Update(entity);
                _unitOfWork.Commit();

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

                result.Id = entity.Id;
            }

            GeneralSettingCacheManager.ClearCache();

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