public void Handle(IBulkStandardDayPartGroupCreated command)
        {
            var daypartGroups = _mapper.Map <List <StandardDayPartGroup> >(command.Data);

            _standardDayPartRepository.ValidateDayParts(command.Data.Where(c => c.Splits != null && c.Splits.Any()).SelectMany(c => c.Splits.Select(d => d.DayPartId)).ToList());
            _salesAreaRepository.ValidateSalesArea(daypartGroups.Select(c => c.SalesArea).ToList());
            _demographicRepository.ValidateDemographics(daypartGroups.Select(c => c.Demographic).ToList());

            _standardDayPartGroupRepository.AddRange(daypartGroups);
            _standardDayPartGroupRepository.SaveChanges();
        }
Ejemplo n.º 2
0
 public void Handle(IBulkStandardDayPartGroupDeleted command)
 {
     _standardDayPartGroupRepository.Truncate();
     _standardDayPartGroupRepository.SaveChanges();
 }