public void Handle(IBulkSpotBookingRuleCreated command)
        {
            var spotBookingRules = _mapper.Map <List <SpotBookingRule> >(command.Data);

            _salesAreaRepository.ValidateSalesArea(command.Data.Where(c => c.SalesAreas != null && c.SalesAreas.Any()).SelectMany(c => c.SalesAreas).ToList());
            _metadataRepository.ValidateBreakType(command.Data.Select(c => c.BreakType).ToList());

            _spotBookingRuleRepository.AddRange(spotBookingRules);
            _spotBookingRuleRepository.SaveChanges();
        }
示例#2
0
 public void Handle(IBulkSpotBookingRuleDeleted command)
 {
     _spotBookingRuleRepository.Truncate();
     _spotBookingRuleRepository.SaveChanges();
 }