private void AddPassPartoutWeekToDB(PassParToutWeek passParToutWeek, int orderId) { if (passParToutWeek.Count > 0) { List <PassPartoutType> ppttList = passPartoutTypeRepository.GetAllPassPartoutType().ToList(); foreach (PassPartoutType type in ppttList) { if (type.Name.Equals(passParToutWeek.Type)) { passParToutWeek.Id = type.Id; break; } } PassPartoutOrder passPartoutOrderWeek = new PassPartoutOrder { OrderId = orderId, PassPartoutId = passParToutWeek.Id }; for (int i = 0; i < passParToutWeek.Count; i++) { passPartoutOrderRepository.AddPassPartoutOrder(passPartoutOrderWeek); } eventRepository.LowerAllAvailableSeats(passParToutWeek.Count); } }
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); } }
public void AddPassPartoutOrder(PassPartoutOrder passPartoutOrder) { db.PassPartoutOrder.Add(passPartoutOrder); db.SaveChanges(); }