public ServerActionResult Hello() { Authorization authorization = SessionController.GetSessionAuthorization(HttpContext); if (authorization == Authorization.Unauthorized) { return(new ServerActionResult(ServerActionResult.Status.Unauthorized)); } ServerResponse response = new ServerResponse(); Account sessionAccount = SessionController.GetSessionAccount(HttpContext); AccountController.GetAccountDetails(sessionAccount); if (authorization == Authorization.User) { (User user, ServerException exception) = AccountController.GetAccountUser(sessionAccount); response.InsertData(user.GetServerModel(), user); } else { (Admin admin, ServerException exception) = AccountController.GetAccountAdmin(sessionAccount); response.InsertData(admin.GetServerModel(), admin); } return(new ServerActionResult(ServerActionResult.Status.Ok, response)); }
public ServerActionResult CreateAdmin(Admin create) { if (SessionController.GetSessionAuthorization(HttpContext) != Authorization.Admin) { return(new ServerActionResult(ServerActionResult.Status.Unauthorized)); } ServerResponse response = new ServerResponse(); response.Exception = AccountController.RegisterAdmin(create.Account, create); return(new ServerActionResult(ServerActionResult.Status.Ok, response)); }