public StaffController(Petrol_StationContext context) { this.context = context; }
public CostsController(Petrol_StationContext context, CacheProvider cacheProvider) { this.context = context; cache = cacheProvider; }
public static void Initialize(Petrol_StationContext petrol_Station) { petrol_Station.Database.EnsureCreated(); int rowCount; int rowIndex; int minStringLength; int maxStringLength; if (!petrol_Station.Gsm.Any()) { string typeOfGSM; string tTKOfType; rowCount = 500; rowIndex = 0; while (rowIndex < rowCount) { minStringLength = 8; maxStringLength = 16; typeOfGSM = GetString(minStringLength, maxStringLength); maxStringLength = 32; tTKOfType = GetString(minStringLength, maxStringLength); petrol_Station.Gsm.Add(new Gsm { TTkofType = tTKOfType, TypeOfGsm = typeOfGSM }); rowIndex++; } petrol_Station.SaveChanges(); } if (!petrol_Station.Staff.Any()) { string fullName; int staffAge; string staffFunction; DateTime workingHoursForAWeek; rowCount = 20000; rowIndex = 0; while (rowIndex < rowCount) { minStringLength = 8; maxStringLength = 32; fullName = GetString(minStringLength, maxStringLength); staffAge = random.Next(1, 11); staffFunction = GetString(minStringLength, maxStringLength); workingHoursForAWeek = GetDateTime(); petrol_Station.Staff.Add(new Staff { FullName = fullName, StaffAge = staffAge, StaffFunction = staffFunction, WorkingHoursForAweek = workingHoursForAWeek, }); rowIndex++; } } if (!petrol_Station.IncomeAndExpensesOfGsm.Any()) { minStringLength = 8; maxStringLength = 32; int numberOfCapacity; int incomeOrExpensePerliter; DateTime dateAndTimeOfTheOperationIncomeOrExpense; string responsibleForTheOperation; rowCount = 20000; rowIndex = 0; while (rowIndex < rowCount) { numberOfCapacity = random.Next(1, 8); incomeOrExpensePerliter = random.Next(1, 13); dateAndTimeOfTheOperationIncomeOrExpense = GetDateTime(); responsibleForTheOperation = GetString(minStringLength, maxStringLength); petrol_Station.IncomeAndExpensesOfGsm.Add(new IncomeAndExpensesOfGsm { NumberOfCapacity = numberOfCapacity, IncomeOrExpensePerliter = incomeOrExpensePerliter, DateAndTimeOfTheOperationIncomeOrExpense = dateAndTimeOfTheOperationIncomeOrExpense, ResponsibleForTheOperation = responsibleForTheOperation }); rowIndex++; } petrol_Station.SaveChanges(); } }
public IncomeAndExpensesOfGsmController(Petrol_StationContext context, CacheProvider cacheProvider) { this.context = context; cache = cacheProvider; }
public IncomeAndExpensesOfGsmController(Petrol_StationContext context) { this.context = context; }
public async Task Invoke(HttpContext context, Petrol_StationContext petrol) { DbInitializer.Initialize(petrol); await _next.Invoke(context); }