public ActionResult <Admin> RegisterMethod(AdminRegistrationDto _NewAdmin) { //Garbage collect invalid admins. Here until a timed action is set on the hosted server. dbQuery.DeleteOutOfDateInvalidAdmins(); Admin NewAdmin = new Admin() { username = _NewAdmin.username, email = _NewAdmin.email, password = _NewAdmin.password, token = _tGen.GenerateToken() }; string verdict = validator.ValidateAdmin(NewAdmin); if (verdict == "pass") { string unhashed_password = _NewAdmin.password; NewAdmin.password = authenticator.HashString(_NewAdmin.password); Admin RegisteredAdmin; try{ RegisteredAdmin = dbQuery.SaveNewAdmin(NewAdmin); }catch (System.ArgumentException e) { return(StatusCode(400, e.Message)); } dbQuery.CreateNewDataPlan(RegisteredAdmin.admin_id); mailer.SendRegistrationConfirmationEmail(RegisteredAdmin.email, RegisteredAdmin.admin_id, RegisteredAdmin.token, _currentDomain); return(RegisteredAdmin); } else { return(StatusCode(400, verdict)); } }