public IActionResult Table(string userId, string pass) { using (var db = new AppsContext()) { var usuarios = (from userRoldb in db.UsuarioRol join rol in db.Roles on userRoldb.RolId equals rol.Id join user in db.Usuarios on userRoldb.UsuarioId equals user.Id select new JoinUsuarioRol { RolName = rol.NombreRol, UserName = user.Nombre, UserId = user.Id, UserEnter = user.UsuarioId, UserPass = user.Pass }).ToList(); var usuario = usuarios .Single(u => u.UserEnter == userId); if (usuario.UserEnter == userId && usuario.UserPass == pass && usuario.RolName != "NoVer") { return(View(usuarios)); } else { return(RedirectToAction("Login")); } } }
public IActionResult Create() { using (var db = new AppsContext()) { var roles = db.Roles.ToList(); return(View(roles)); } }
public TestRunController(IWebHostEnvironment env, AppsData data, OpenQA.Selenium.Chrome.ChromeDriver driver, AppsContext ctx) { _env = env; _db = data.AppsDB; _data = data; _driver = driver; _ctx = ctx; }
public IActionResult UpdateOk(int userId, string userEnter, string userName, string UserPass) { using (var db = new AppsContext()) { var usuario = db.Usuarios .Single(u => u.Id == userId); usuario.Nombre = userName; usuario.UsuarioId = userEnter; usuario.Pass = UserPass; db.SaveChanges(); return(RedirectToAction("Login")); } }
public IActionResult Delete(int userId) { using (var db = new AppsContext()) { var usuarioRol = db.UsuarioRol .Single(r => r.UsuarioId == userId); var usuario = db.Usuarios .Single(u => u.Id == userId); db.Remove(usuarioRol); db.Remove(usuario); db.SaveChanges(); return(RedirectToAction("Login")); } }
public IActionResult Update(int userId) { using (var db = new AppsContext()) { var usuarios = (from userRoldb in db.UsuarioRol join rol in db.Roles on userRoldb.RolId equals rol.Id join user in db.Usuarios on userRoldb.UsuarioId equals user.Id select new JoinUsuarioRol { RolName = rol.NombreRol, UserName = user.Nombre, UserId = user.Id, UserEnter = user.UsuarioId, UserPass = user.Pass }).ToList(); var usuario = usuarios.Single(u => u.UserId == userId); return(View(usuario)); } }
public IActionResult Index() { using (var db = new AppsContext()) { var usuarios = from userRoldb in db.UsuarioRol join rol in db.Roles on userRoldb.RolId equals rol.Id join user in db.Usuarios on userRoldb.UsuarioId equals user.Id select new JoinUsuarioRol { RolName = rol.NombreRol, UserName = user.Nombre, UserId = user.Id, UserEnter = user.UsuarioId, UserPass = user.Pass }; List <JoinUsuarioRol> innerjoinresult_as_JoinUsuarioRol_list = usuarios.ToList(); return(View(innerjoinresult_as_JoinUsuarioRol_list)); } }
public async Task <IActionResult> CreateOk(string userName, string userEnter, string userPass, int rolId) { using (var db = new AppsContext()) { db.Add(new Usuarios { Nombre = userName, UsuarioId = userEnter, Pass = userPass }); await db.SaveChangesAsync(); var usuario = await db.Usuarios.SingleAsync(u => u.UsuarioId == userEnter); db.Add(new UsuarioRol { UsuarioId = usuario.Id, RolId = rolId }); await db.SaveChangesAsync(); return(RedirectToAction("Login")); } }
public EnrollmentController(AppsContext context) { _context = context; }
public AppsController(IWebHostEnvironment env, AppsData data, AppsContext ctx) { _env = env; _db = data.AppsDB; _ctx = ctx; }
public StudentController(AppsContext context) { _context = context; }
public Repository(AppsContext context) : base(context) { }
public CoursesController(AppsContext context) { _context = context; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //services.AddDbContext<AppsContext>(options => //options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); //Selenium Driver //Action<OpenQA.Selenium.Chrome.ChromeDriver> chromeDriver = (cd => { //}); //services.addeaddeAddEntityFrameworkSqlite().AddDbContext<DatabaseContext>(); services.AddSingleton<OpenQA.Selenium.Chrome.ChromeDriver>(new OpenQA.Selenium.Chrome.ChromeDriver(Environment.CurrentDirectory + "\\Libraries")); //Main db Action<AppsData> liteDBOptions = (opt => { opt.AppsDBPath = System.Environment.CurrentDirectory + "\\Business\\Data\\Apps.db"; opt.AppsDB = new LiteDB.LiteDatabase(opt.AppsDBPath); }); //Main ef context Action<AppsContext> contextOptions = (opt => { opt = new AppsContext(); }); services.AddSingleton(resolver => resolver.GetRequiredService<IOptions<AppsContext>>().Value); ////Flows db //Action<FlowsData> flowDBOptions = (opt => //{ // opt.FlowsDBPath = System.Environment.CurrentDirectory + "\\Flows.db"; // opt.FlowsDB = new LiteDB.LiteDatabase(opt.FlowsDBPath); //}); services.Configure(liteDBOptions); services.AddSingleton(resolver => resolver.GetRequiredService<IOptions<AppsData>>().Value); //services.Configure(flowDBOptions); //services.AddSingleton(resolver => resolver.GetRequiredService<IOptions<FlowsData>>().Value); //services.AddCors(options => //{ // options.AddPolicy(MyAllowSpecificOrigins, // builder => // { // builder.WithOrigins("http://localhost:52780"); // }); //}); services.AddSignalR(); services.AddControllers(); services.AddMvcCore().AddNewtonsoftJson(options => { options.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented; options.SerializerSettings.ContractResolver = new DefaultContractResolver(); }); //services.AddOcelot(); //var builder = services.AddIdentityServer() // .AddDeveloperSigningCredential() //This is for dev only scenarios when you don’t have a certificate to use. // .AddInMemoryApiScopes(IdentityServerTest.Config.ApiScopes) // .AddInMemoryClients(IdentityServerTest.Config.Clients); //// this comes from Ocelot.Tracing.Butterfly package //services.AddButterfly(option => //{ // //this is the url that the butterfly collector server is running on... // option.CollectorUrl = "https://localhost:9618"; // option.Service = "Ocelot"; //}); //services.AddIdentityServer() // .AddDeveloperSigningCredential() // //.AddInMemoryApiResources(new[] { new ApiResource("socialnetwork", "Social Network") }) // .AddInMemoryClients(new[] { new Client{ // ClientId = "socialnetwork", // ClientSecrets = new [] { new Secret("secret".Sha256())}, // AllowedGrantTypes = GrantTypes.ResourceOwnerPasswordAndClientCredentials, // AllowedScopes = new[] {"socialnetwork"} // } // }).AddInMemoryApiScopes(new[] { new ApiScope("socialnetwork", "My API") }); //.AddTestUsers(new List<IdentityServer4.Test.TestUser> { // new IdentityServer4.Test.TestUser // { // SubjectId = "1", // Username = "******", // Password = "******" // } //services.AddAuthentication("Bearer").AddJwtBearer("Bearer", options => //{ // options.Authority = "https://localhost:54321"; // options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters // { // ValidateAudience = false // }; //}); //// Add Hangfire services. //services.AddHangfire(configuration => configuration // .SetDataCompatibilityLevel(CompatibilityLevel.Version_170) // .UseSimpleAssemblyNameTypeSerializer() // .UseRecommendedSerializerSettings() // .UseMemoryStorage()); //// Add the processing server as IHostedService //services.AddHangfireServer(); //var flowsDb = new LiteDB.LiteDatabase(System.Environment.CurrentDirectory + "\\Flows.db"); //FlowsData.FlowTable = flowsDb.GetCollection<AppFlowEvent>("Flows"); //var clientConfig = new AppsClientConfig(); //clientConfig.Load("Brooksoft.Apps", Environment.MachineName, Environment.CurrentDirectory, new System.Version(0, 0, 1), new List<string>(), new List<AppsCustomConfigItem>(), true, true, new AppFlow()); AppsLog.LogInfo("Finished configure services."); //var perms = new Brooksoft.Apps.Business.Publish.Permissions(); //perms.ReadEffectivePermissions(); }
public TaskItemsController(AppsContext context) { _context = context; }
public BaseRepository(AppsContext context) { _dbContext = context ?? throw new ArgumentException(nameof(context)); _dbSet = _dbContext.Set <T>(); }