This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parents.foreach(p => p.childs = parents.Where(pa => pa.ParentId == p.Id)); | |
return parents.Where(p => p.Id == null); //Returns the very top of the tree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>API</title> | |
<link rel="icon" type="image/png" href="images/favicon-32x32-png" sizes="32x32" /> | |
<link rel="icon" type="image/png" href="images/favicon-16x16-png" sizes="16x16" /> | |
<link href='css/typography-css' media='screen' rel='stylesheet' type='text/css' /> | |
<link href='css/reset-css' media='screen' rel='stylesheet' type='text/css' /> | |
<link href='css/screen-css' media='screen' rel='stylesheet' type='text/css' /> | |
<link href='css/reset-css' media='print' rel='stylesheet' type='text/css' /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApplyBasicAuth : IOperationFilter | |
{ | |
public string Name { get; private set; } | |
public ApplyBasicAuth() | |
{ | |
Name = "basic"; | |
} | |
public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addBasicAuthorization() { | |
var username = $('#input_username').val(); | |
var password = $('#input_password').val(); | |
if (username && username.trim() != "" && password && password.trim() != "") { | |
var basicAuth = new SwaggerClient.PasswordAuthorization('basic', username, password); | |
window.swaggerUi.api.clientAuthorizations.add("basicAuth", basicAuth); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="input"><input placeholder="username" id="input_username" name="username" type="text" size="10"></div> | |
<div class="input"><input placeholder="password" id="input_password" name="password" type="password" size="10"></div> | |
<Button id="loginbutton">Log in</Button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class SwaggerExtensions | |
{ | |
public static void ApplyBasicAuth(this SwaggerDocsConfig c) | |
{ | |
var basicAuth = new ApplyBasicAuth(); | |
basicAuth.Apply(c); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c.BasicAuth("basic").Description("HTTP Authentication Method"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Swagger UI</title> | |
<link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" /> | |
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" /> | |
<link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/> | |
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/> | |
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GlobalConfiguration.Configuration | |
.EnableSwagger(c => | |
{ | |
... | |
c.BasicAuth("basic").Description("HTTP Authentication Method"); | |
c.OperationFilter<ApplyBasicAuth>(); | |
... | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet] | |
public IHttpResult Books(int page = 1, int pageSize = 20) | |
{ | |
List<Book> books = BooksRepository.AllBooks(); | |
return books.Take(pageSize).Skip((page-1)*pageSize).ToList(); | |
} |
OlderNewer