Ejemplo n.º 1
0
        public async Task <IActionResult> Create(UserVoice userVoice)
        {
            if (string.IsNullOrWhiteSpace(userVoice.Content))
            {
                _agileLabsDbContext.Add(userVoice);
                await _agileLabsDbContext.SaveChangesAsync();

                return(RedirectToAction(nameof(Thanks)));
            }
            return(View());
        }
Ejemplo n.º 2
0
 public bool addEntity(Tenant newTenant)
 {
     if (_context.Tenants.Where(c => c.SubDomainName == newTenant.SubDomainName).Count() == 0)
     {
         _context.Add(newTenant);
         saveAll();
         string connectionString = null;
         try
         {
             connectionString = onTenantEntry(newTenant);
         }
         catch (Exception ex)
         {
             connectionString = null;
         }
         try
         {
             if (connectionString != null)
             {
                 var dbContextOptionsBuilder = new DbContextOptionsBuilder <TenantContext>();
                 dbContextOptionsBuilder.UseNpgsql(_configuration.GetConnectionString("DefaultConnectionString"));
                 TenantContext tenantContext_temp = new TenantContext(dbContextOptionsBuilder.Options);
                 Tenant        recent_tenant      = tenantContext_temp.Tenants.Last();
                 recent_tenant.ConnectionStringName = connectionString;
                 tenantContext_temp.SaveChanges();
             }
         }
         catch (Exception ex)
         {
             return(false);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 public void Add(Portfolio portfolio)
 {
     _context.Add(portfolio);
     _context.SaveChanges();
 }