public async Task <AdminStipulatable> GetTest([FromBody] TestQuery login) { if (!await this.VerifySession(_manager) || !await this.VerifyAdmin(_query)) { Response.StatusCode = 403; return(null); } var test = await _query.GetTest(login.TestID); if (test == null) { Response.StatusCode = 404; return(null); } var adminStipulatable = new AdminStipulatable(test); adminStipulatable.Validate(_config); return(adminStipulatable); }
public async Task <List <AdminStipulatable> > GetTests([FromBody] TestQuery login) { if (!await this.VerifySession(_manager) || !await this.VerifyAdmin(_query)) { Response.StatusCode = 403; return(null); } var tests = await _query.GetAllTests(); var validatedTests = new List <AdminStipulatable>(); foreach (var test in tests) { var adminStipulatable = new AdminStipulatable(test); adminStipulatable.Validate(_config); validatedTests.Add(adminStipulatable); } return(validatedTests); }