private void AddPassPartoutDaysToDB(List <PassParToutDay> passParToutDays, int orderId) { foreach (PassParToutDay pd in passParToutDays) { List <PassPartoutType> ppttList = passPartoutTypeRepository.GetAllPassPartoutType().ToList(); foreach (PassPartoutType type in ppttList) { if (type.Name.Equals(pd.Day)) { pd.Id = type.Id; break; } } PassPartoutOrder passPartoutOrder = new PassPartoutOrder { OrderId = orderId, PassPartoutId = pd.Id }; for (int i = 0; i < pd.Count; i++) { passPartoutOrderRepository.AddPassPartoutOrder(passPartoutOrder); } Day day = dayRepository.GetDayByName(pd.Day); eventRepository.LowerAvailableSeatsforDay(day.Id, pd.Count); } }