public TS_09RepairShips_BaggageTrains[] GetTSRepairShips_BaggageTrains(string turnId) { using (var dataContext = new AusterlitzDbContext()) { var listRepository = new GenericRepository <TS_09RepairShips_BaggageTrains>(dataContext); var tsItems = listRepository.GetItems(x => x.TurnId == turnId).OrderBy(y => y.OrderNo); if (tsItems.Count() == 0) { var newItems = new TS_09RepairShips_BaggageTrains[6]; for (var itemCount = 1; itemCount <= newItems.Count(); itemCount++) { TS_09RepairShips_BaggageTrains item = new TS_09RepairShips_BaggageTrains() { TurnId = turnId, OrderNo = itemCount }; newItems[itemCount - 1] = item; } listRepository.InsertRange(newItems); dataContext.SaveChanges(); tsItems = listRepository.GetItems(x => x.TurnId == turnId).OrderBy(y => y.OrderNo); } return(tsItems.ToArray()); } }
public TS_09RepairShips_BaggageTrains[] PostTSRepairShips_BaggageTrains(TS_09RepairShips_BaggageTrains[] saveRecords) { var turnReportManager = new Austerlitz.Domain.TurnSheetManager(); return turnReportManager.PostTSRepairShips_BaggageTrains(saveRecords); }