Exemple #1
0
        public static void ConfigureService
            (this IServiceCollection services, IConfiguration configuration)
        {
            services.AddDbContext <InitialDatabase>(options =>
                                                    options.UseSqlServer(configuration.GetConnectionString("InitialDatabase"))
                                                    );

            // A chamada a este Filter aqui, permite que ele também utilize o AccountScope

            services.AddScoped <AccountTicketBinderFilter>();

            // Inicializadores dos serviços e repositórios da aplicação

#warning Separar em módulos

            EnterpriseScope.Bind(services);

            AccountScope.Bind(services);

            GroupScope.Bind(services);

            AreaScope.Bind(services);

            CustomerScope.Bind(services);
        }
        public void InsertAreaScope(AreaScopeViewModel areaScopeVM)
        {
            AreaScope newRecord = new AreaScope {
                AS_Scope = areaScopeVM.Name.Trim()
            };

            context.AreaScopes.Add(newRecord);
            context.SaveChanges();
        }
        public void UpdateAreaScope(AreaScopeViewModel areaScopeVM)
        {
            AreaScope newRecord = new AreaScope {
                AS_Id = areaScopeVM.Id, AS_Scope = areaScopeVM.Name
            };

            context.AreaScopes.Attach(newRecord);
            context.Entry(newRecord).State = EntityState.Modified;
            context.SaveChanges();
        }
 public void DeleteAreaScope(AreaScopeViewModel areaScopeVM)
 {
     try
     {
         AreaScope newRecord = new AreaScope {
             AS_Id = areaScopeVM.Id, AS_Scope = areaScopeVM.Name
         };
         context.AreaScopes.Attach(newRecord);
         context.AreaScopes.Remove(newRecord);
         context.SaveChanges();
     } catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #5
0
 public void AreaScopeTo(AreaScope areaScope)
 {
     AreaGraphController.AreaScope = areaScope;
     UpdateSummaryGraphs();
 }