public StudentController(UserManager <User> userManager, HSEContestDbContext db, TestingSystemConfig config, IHttpContextAccessor httpContextAccessor) : base(db, config) { curId = userManager.GetUserId(httpContextAccessor.HttpContext.User); var curUser = userManager.GetUserAsync(httpContextAccessor.HttpContext.User).Result; isProff = userManager.IsInRoleAsync(curUser, "professor").Result; }
public static TestResponse WriteToDb(HSEContestDbContext _db, TestingResult res, bool recheck) { bool ok = false; if (recheck) { var existing = _db.TestingResults.FirstOrDefault(r => r.SolutionId == res.SolutionId && r.TestId == res.TestId); if (existing != null) { existing.Commentary = res.Commentary; existing.ResultCode = res.ResultCode; existing.Score = res.Score; existing.TestData = res.TestData; _db.SaveChanges(); ok = true; } } else { var x = _db.TestingResults.Add(res); var beforeState = x.State; int r = _db.SaveChanges(); var afterState = x.State; ok = beforeState == EntityState.Added && afterState == EntityState.Unchanged && r == 1; } TestResponse response; if (ok) { response = new TestResponse { OK = true, Message = "success", Result = res.ResultCode, Score = res.Score, TestResultId = res.Id, TestId = res.TestId, }; } else { response = new TestResponse { OK = false, Message = "can't write result to db", Result = ResultCode.IE, Score = res.Score, TestId = res.TestId, }; } return(response); }
public TestingSystemWorker() { string pathToConfig = "c:\\config\\config.json"; _config = JsonConvert.DeserializeObject<TestingSystemConfig>(System.IO.File.ReadAllText(pathToConfig)); DbContextOptionsBuilder<HSEContestDbContext> options = new DbContextOptionsBuilder<HSEContestDbContext>(); options.UseNpgsql(_config.DatabaseInfo.GetConnectionStringFrom(_config.FrontEnd)); _db = new HSEContestDbContext(options.Options); _busControl = RabbitHutch.CreateBus(_config.MessageQueueInfo, _config.TestingSystemWorker); }
public CompilerServicesOrchestrationController(HSEContestDbContext db, TestingSystemConfig config) { _db = db; _config = config; }
public CodeStyleRulesController(HSEContestDbContext db) { _db = db; }
public CodeStyleTesterController(HSEContestDbContext db) { _db = db; }
public FunctionalTesterController(HSEContestDbContext db) { _db = db; }
public FunctionalTestingOrchestratorController(HSEContestDbContext db, TestingSystemConfig config) { _db = db; _config = config; }
public CompilerController(HSEContestDbContext context) { _db = context; }
public TestingSystemController(HSEContestDbContext db, TestingSystemConfig config) { _pathToConfigDir = "c:\\config"; _db = db; _config = config; }
public ProfessorController(HSEContestDbContext db, TestingSystemConfig config) : base(db, config) { }
public GroupsController(UserManager <User> userManager, HSEContestDbContext db) { _db = db; _userManager = userManager; }
public UsersController(UserManager <User> userManager, RoleManager <IdentityRole> roleManager, HSEContestDbContext db) { _userManager = userManager; _roleManager = roleManager; _db = db; }
public ReflectionTesterController(HSEContestDbContext db) { _db = db; }