This file contains 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 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 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 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(); | |
} |
This file contains 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 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 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
var queryString = HttpUtility.ParseQueryString(context.Request.RequestUri.Query); | |
var brandName = queryString.Get("brand"); |
This file contains 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
int offset = 0; | |
int limit = 0; | |
var queryString = HttpUtility.ParseQueryString(context.Request.RequestUri.Query); | |
if(queryString.Count == 0) return; | |
int.TryParse(queryString.Get("offset"), out offset); | |
int.TryParse(queryString.Get("limit"), out limit); |
This file contains 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
var objectContent = context.ActionContext?.Response?.Content as ObjectContent; | |
if (objectContent != null) | |
objectContent.Value = result; |
This file contains 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 PagingFilter : ActionFilterAttribute | |
{ | |
public override void OnActionExecuted(HttpActionExecutedContext context) | |
{ | |
} | |
} |
OlderNewer