Esempio n. 1
0
        public async Task <IActionResult> Edit(string id, [Bind("EnvironmentCode,Description")] Context.Environment environment)
        {
            if (id != environment.EnvironmentCode)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(environment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EnvironmentExists(environment.EnvironmentCode))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(environment));
        }
Esempio n. 2
0
 public CurrentDbConnection()
 {
     //this.ConnectionStringName = "dev-elinar-prod-auto";
     try {
         Context.Environment m_oEnv = new Context.Environment();
         this.ConnectionStringName = m_oEnv.Context.ToLower();
         //Trace.WriteLine("\n\t\t\t**************DB********************" + this.ConnectionStringName);
     } catch (Exception e) {
         throw new NullReferenceException("Failed to determine current environment.", e);
     }
 }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("EnvironmentCode,Description")] Context.Environment environment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(environment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(environment));
        }
Esempio n. 4
0
		} // static constructor

		public static AConnection Get(ASafeLog oLog = null) {
			if (!ReferenceEquals(null, ms_oDB))
				return ms_oDB;

			if (oLog == null)
				oLog = new SafeILog(typeof(DbConnectionGenerator));

			var env = new Context.Environment(oLog);

			lock (ms_oLock) {
				if (ReferenceEquals(null, ms_oDB))
					ms_oDB = new SqlConnection(env, oLog);
			} // lock

			return ms_oDB;
		} // operator AConnection