Last active
November 17, 2022 09:52
-
-
Save luismendes070/81eec98c069d04e125a8426088aee9c9 to your computer and use it in GitHub Desktop.
Xamarin Essentail Training Create Your First App LinkedIn Learning
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
Visual Studio 2022 x64 Community | |
dotnet add package System.Text.Json --version 6.0.0 | |
https://www.linkedin.com/learning/xamarin-essential-training-create-your-first-app-16074381/xamarin-essential-training |
using System;
namespace ProductApp.Library
{
public class Product
{
public string Name { get; set; }
// win ctl + b
// mac cmd + b
public string Description { get; set; }
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
namespace ProductService.Library
{
public class ProductService
{
private const string API_URL = "https://hplusport.com/api";
private static HttpClient _client;
public async Task<List> GetProducts()
{
try
{
var response = await _client.GetAsync(API_URL + "/products");
var products = await response.Content.ReadFromJsonAsync<List>();
return products;
}
catch()
{
return new List();
}
}
}}