public static async Task <IActionResult> GetAll( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "clients/")] HttpRequest req, ILogger log) { log.LogInformation("GetAll() called"); var results = new ClientDataSource().GetAll(); return(new OkObjectResult(results)); }
public static async Task <IActionResult> GetByID( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "clients/{id}/")] HttpRequest req, string id, ILogger log) { log.LogInformation("GetSingle() called"); var guid = GuidHelper.GetFromString(id); if (guid == null) { return(new BadRequestObjectResult("Invalid guid")); } var results = new ClientDataSource().GetFiltered(c => c.ID == guid.Value).FirstOrDefault(); return(results != null ? (IActionResult) new OkObjectResult(results) : (IActionResult) new NotFoundObjectResult("No client found with identifier")); }