Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions Refactoring/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@

namespace Refactoring
{
[Serializable]
public class Product
{
[JsonProperty("Name")]
public string Name;
[JsonProperty("Price")]
public double Price;
[JsonProperty("Quantity")]
public int Qty;
}
[Serializable]
public class Product
{
[JsonProperty("Name")]
public string Name;

[JsonProperty("Price")]
public double Price;

[JsonProperty("Quantity")]
public int Quantity;
}
}
26 changes: 17 additions & 9 deletions Refactoring/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,25 @@

namespace Refactoring
{
public class Program
public class Program
{
public static void Main(string[] args)
{
public static void Main(string[] args)
{
// Load users from data file
List<User> users = JsonConvert.DeserializeObject<List<User>>(File.ReadAllText(@"Data/Users.json"));
List<User> users = getUsers();
List<Product> products = getProducts();

// Load products from data file
List<Product> products = JsonConvert.DeserializeObject<List<Product>>(File.ReadAllText(@"Data/Products.json"));
Tusc tusc = new Tusc(users, products);
tusc.Start();
}

Tusc.Start(users, products);
}
private static List<Product> getProducts()
{
return JsonConvert.DeserializeObject<List<Product>>(File.ReadAllText(@"Data/Products.json"));
}

private static List<User> getUsers()
{
return JsonConvert.DeserializeObject<List<User>>(File.ReadAllText(@"Data/Users.json"));
}
}
}
1 change: 1 addition & 0 deletions Refactoring/Refactoring.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Tusc.cs" />
<Compile Include="UserAuthentication.cs" />
<Compile Include="User.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
Loading