public void EnsureSeedData(ConfigDbContext context) { using (var transaction = context.Database.BeginTransaction()) { var anyData = context.ColorTypes.Any() || context.OrderStatuses.Any() || context.RimTypes.Any() || context.FuelTypes.Any() || context.Cars.Any() || context.Colors.Any() || context.Engines.Any() || context.Rims.Any() || context.AdditionalEquipmentItems.Any(); if (!anyData) { ImportJson(context, context.ColorTypes, "ColorTypes"); ImportJson(context, context.FuelTypes, "FuelTypes"); ImportJson(context, context.OrderStatuses, "OrderStatuses"); ImportJson(context, context.RimTypes, "RimTypes"); ImportJson(context, context.Colors, "Colors"); ImportJson(context, context.Engines, "Engines"); ImportJson(context, context.Rims, "Rims"); ImportJson(context, context.Cars, "Cars"); ImportJson(context, context.AdditionalEquipmentItems, "AdditionalEquipmentItems"); transaction.Commit(); } } }
public string GetSetting(string key) { using (var db = new ConfigDbContext()) { var setting = db.Set <ConfigSetting>().SingleOrDefault(c => c.Key.Equals(key, StringComparison.InvariantCultureIgnoreCase)); return(setting == null ? string.Empty : setting.Value); } }
//public private public ConfigsController(ConfigDbContext context) { _context = context; _unitOfWork = new EfUnitOfWork(_context); _configRepository = new EFRepository <Config>(_context); connection = factory.CreateConnection(); channel = connection.CreateModel(); }
public AuthorizerConfigReader(ConfigDbContext context) { _context = context; _authorizerName = GetAuthorizerName(); if (_authorizerName == "") { throw new ArgumentException("Class " + typeof(TAuthorizer).Name + " does not have 'Authorizer' attribute defined"); } }
private static bool CheckIfIcuIsPresent(int icuNo) { ConfigDbContext context = new ConfigDbContext(); var icuStore = context.Icu.ToList(); if (icuStore.FirstOrDefault(item => item.IcuNo == icuNo) == null) { return(false); } return(true); }
protected override Object DoInBackground(params Object[] @params) { DataHolder.ClubList = new GetData().GetClubsName(); DataHolder.TopClubsModels = new GetData().GetTopFiveClub(); var guid = new ConfigDbContext().SelectUserGuid().Result; if ((DataHolder.User = new GetData().GetLoginUser(guid)) != null) { new ConfigDbContext().UpdateData <UserModel>(DataHolder.User); } return(true); }
public static void DeleteVitalLogsForDischargedPatient(int patientId) { ConfigDbContext context = new ConfigDbContext(); var vitalsStore = context.VitalsLogs.ToList(); var vitalsToRemove = vitalsStore.Where(item => item.PatientId == patientId).ToList(); foreach (VitalsLogs vitals in vitalsToRemove) { context.Remove(vitals); context.SaveChanges(); } }
public void SaveSetting(string key, string value) { using (var db = new ConfigDbContext()) { var setting = db.Set <ConfigSetting>().SingleOrDefault(c => c.Key.Equals(key, StringComparison.InvariantCultureIgnoreCase)); if (setting == null) { setting = new ConfigSetting { Key = key }; db.Set <ConfigSetting>().Add(setting); } setting.Value = value; db.SaveChanges(); } }
public void ConfigureServices(IServiceCollection services) { #region Register DB Context ConfigDbContext.Register(Configuration, services); #endregion #region CORS var allowedCors = Configuration.GetSection("CORS") .AsEnumerable() .Where(h => !string.IsNullOrEmpty(h.Value)) .Select(h => h.Value).ToArray(); services.AddCors(options => { options.AddPolicy(_allowOriginPolicy, builder => { builder.WithOrigins(allowedCors) .SetIsOriginAllowedToAllowWildcardSubdomains() .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); }); }); #endregion services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0) .AddNewtonsoftJson(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore); services.AddSwaggerServices(); services.AddControllers() .AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null); #region Register Application Services ConfigServices.Register(services); #endregion }
public AOrderRepository(AOrderDTO updateEntity, IEnumerable <ICommandAble> references, DateTime updateDatetime, string updateUser, OrderDbContext orderDbContext, ConfigDbContext configDbContext) { _AOrder = updateEntity; _customer = references.First() as CustomerDTO; _updateDatetime = updateDatetime; _updateUser = updateUser; _lastUpdatedOrderCommonEntity = _orderDbContest.OrderCommons .SingleOrDefault(i => i.Id == _AOrder.Id); _lastUpddatedOrderAEntity = _orderDbContest.AOrders .SingleOrDefault(i => i.Id == _AOrder.Id); Debug.Assert(_lastUpdatedOrderCommonEntity != null ? _lastUpddatedOrderAEntity != null : _lastUpddatedOrderAEntity == null); _orderDbContest = orderDbContext; _configDbContext = configDbContext; }
public EfConfigController(ConfigDbContext config, ILoggerFactory loggerFactory) { _config = config ?? throw new ArgumentNullException(nameof(config)); _logger = loggerFactory?.CreateLogger <EfConfigController>() ?? throw new ArgumentNullException(nameof(loggerFactory)); }
public ProfilesController(ConfigDbContext dbContext, IActors actors) : base(dbContext) { _actors = actors; }
public OrderRepository(ConfigDbContext context) : base(context) { DbSet = context.Orders; }
public EFRepository(ConfigDbContext dbContext) { _dbContext = dbContext ?? throw new ArgumentNullException("dbContext can not be null."); _dbSet = dbContext.Set <T>(); }
public ConfigReader(ConfigDbContext dbContext) { _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext)); }
public SelectApiResourceViewComponent(ConfigDbContext context) { _context = context; }
protected RepositoryBase(ConfigDbContext context) { Context = context; }
public MerchantsController(ConfigDbContext context, IMerchantConfigService merchantConfigService) { _context = context; _merchantConfigService = merchantConfigService; }
public Repository(ConfigDbContext context) { _context = context; }
public SimpleCrudController(ConfigDbContext dbContext) { _dbContext = dbContext; }
public ProcessorConfigService(ConfigDbContext context) { _context = context; }
public UsersController(CoreDbContext coreDbContext, ConfigDbContext configDbContext) { m_CoreDbContext = coreDbContext; m_ConfigDbContext = configDbContext; }
public MerchantConfigService(ConfigDbContext context) { _context = context; }
public ConfigController(ConfigDbContext configDbContext) { m_ConfigDbContext = configDbContext; }
public ApiResourceController(ConfigDbContext context) { _context = context; }
public RimRepository(ConfigDbContext context) : base(context) { DbSet = context.Rims; }
public AdditionalEquipmentRepository(ConfigDbContext context) : base(context) { DbSet = context.AdditionalEquipmentItems; }
public BuildServersController(ConfigDbContext dbContext) : base(dbContext) { }
public CustomerRepository(ConfigDbContext dbContext) { _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext)); }
public CarRepository(ConfigDbContext context) : base(context) { DbSet = context.Cars; }
public ApiSecretsController(ConfigDbContext context) { _context = context; }