public TS_23ChangeStateRelationships[] GetTSChangeStateRelationships(string turnId) { using (var dataContext = new AusterlitzDbContext()) { var listRepository = new GenericRepository <TS_23ChangeStateRelationships>(dataContext); var tsItems = listRepository.GetItems(x => x.TurnId == turnId).OrderBy(y => y.OrderNo); if (tsItems.Count() == 0) { var newItems = new TS_23ChangeStateRelationships[4]; for (var itemCount = 1; itemCount <= newItems.Count(); itemCount++) { TS_23ChangeStateRelationships item = new TS_23ChangeStateRelationships() { 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_23ChangeStateRelationships[] PostTSChangeStateRelationships(TS_23ChangeStateRelationships[] saveRecords) { var turnReportManager = new Austerlitz.Domain.TurnSheetManager(); return turnReportManager.PostTSChangeStateRelationships(saveRecords); }