Esempio n. 1
0
        public async Task <FilterDetailsDto> Insert(FilterCreateDto createDto)
        {
            var filter = Mapper.Map <Filter>(createDto);

            List <FilterCondition> filterConditons = new List <FilterCondition>();

            filterConditons = Mapper.Map <List <FilterConditionCreateDto>, List <FilterCondition> >(createDto.Conditions.ToList());
            _domainService.CheckFieldIdExist(filterConditons);
            _domainService.CheckFieldValue(filterConditons);
            filter.Conditions = filterConditons;
            filter            = _domainService.Insert(filter);
            CurrentUnitOfWork.SaveChanges();

            await _notificationManager.NotifyNewFilter(filter.SiteId, filter.Id);

            var filterDto = Mapper.Map <FilterDetailsDto>(filter);
            List <FilterDetailsDto> filterDtos = new List <FilterDetailsDto>();

            filterDtos.Add(filterDto);
            _agentService.FillCreatedByName(filterDtos);
            _auditLogService.Audit(3, $"Add Filter (Id: {filterDto.Id})", null, filterDto);
            return(filterDto);
        }