-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGetOutlet.cs
42 lines (40 loc) · 1.48 KB
/
GetOutlet.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace bhoojal.api
{
public static class GetOutlet
{
/// <summary>
/// Get Outlet details
/// </summary>
/// <group>Get Outlet details V1</group>
/// <verb>GET</verb>
/// <url>https://bhoojal-api.azurewebsites.net/api/outlet/{city}/{id}</url> ///
/// <param name="id" cref="string" in="path">The outlet id</param>
/// <param name="city" cref="string" in="path">The outlet city</param>
/// <response code="200"><see cref="Outlet"/>Outlet</response>
/// <response code="400"></response>
/// <returns>Outlet</returns>
[FunctionName("GetOutlet")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "outlet/{city}/{id}")] HttpRequest req,
[CosmosDB(databaseName: "bhoojal_outlets", collectionName: "outlet", Id = "{id}",
PartitionKey = "{city}", ConnectionStringSetting = "CosmosDBConnectionString")] Outlet outlet,
ILogger log,
string id)
{
if (outlet == null)
{
return new NotFoundResult();
}
return new OkObjectResult(outlet);
}
}
}