public List <Photo> GetPhotosByAlbumId(int albumId) { var response = getService.Get($"?albumId={albumId}"); response.EnsureSuccessStatusCode(); var responseJson = response.Content.ReadAsStringAsync().Result; return(JsonSerializer.Deserialize <List <Photo> >(responseJson, jsonSerializerOptions)); }
public static async Task <ActionResult <T> > Get <T, TKey>(this Controller controller, IGetService <T, TKey> manager, TKey id) where T : class where TKey : IComparable { var dto = await manager.Get(id); if (dto == null) { return(controller.NotFound()); } return(controller.Ok(dto)); }
public ActionResult <Quiz> Get() { var quiz = _service.Get(); if (quiz == null) { return(NotFound()); } return(quiz); }
/// <summary> /// A Lambda function that returns images metadata from S3 Bucket by s3ObjectKey. /// path for http request: /{s3ObjectKey} /// </summary> /// <param name="request"></param> /// <param name="context"></param> /// <returns></returns> public async Task <APIGatewayProxyResponse> GetMetadataAsync(APIGatewayProxyRequest request, ILambdaContext context) { string s3ObjectKey = GetRequestParams(request); if (string.IsNullOrEmpty(s3ObjectKey)) { return(new APIGatewayProxyResponse { StatusCode = (int)HttpStatusCode.BadRequest, Body = $"Missing required parameter {ID_QUERY_STRING_NAME}" }); } context.Logger.LogLine($"Getting object {s3ObjectKey}"); try { var resultado = await getService.Get(s3ObjectKey); context.Logger.LogLine($"Found object: {resultado.ImageMetadataId != null}"); var response = new APIGatewayProxyResponse { StatusCode = (int)HttpStatusCode.OK, Body = JsonConvert.SerializeObject(resultado), Headers = new Dictionary <string, string> { { "Content-Type", "application/json" } } }; return(response); } catch (Exception e) { return(new APIGatewayProxyResponse { StatusCode = (int)HttpStatusCode.NotFound, Body = e.Message }); } }
public object GetName(string name, int age) { var getname = _getService.Get(name); return(new { OutPut = getname, Age = age }); }
public virtual IActionResult Get(long id) { var result = Service.Get(id); return(Ok(result)); }