-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (29 loc) · 1.17 KB
/
Copy pathProgram.cs
File metadata and controls
36 lines (29 loc) · 1.17 KB
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
using System;
using ConsoleApp1.Repostory;
using Json_Csharp.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
namespace Json_Csharp
{
internal class Program
{
internal static void Main(string[] args)
{
BrandRepository brandRepository = new BrandRepository();
List<Brand> dataListBrand = brandRepository.GetDatalist();
string jsonDataBrand = JsonConvert.SerializeObject(dataListBrand);
List<Brand> brands = JsonConvert.DeserializeObject<List<Brand>>(jsonDataBrand);
List<Brand> JsonDataReadBrand = brands;
List<Product> dataListProduct = new ProductRepository().GetDataList();
string jsonDataListProduct = JsonConvert.SerializeObject(dataListProduct);
string jsonDataProduct = JsonConvert.SerializeObject(dataListProduct[0]);
Console.WriteLine(dataListProduct);
Console.WriteLine(jsonDataListProduct);
Console.WriteLine(jsonDataProduct);
Console.ReadLine();
}
}
}