add menu
This commit is contained in:
parent
1889ede866
commit
9c1a47e720
@ -1,28 +1,33 @@
|
|||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using System.Runtime.InteropServices.ComTypes;
|
using System.Runtime.InteropServices.ComTypes;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
using LootBoxSimulator.Models.DAO;
|
using LootBoxSimulator.Models.DAO;
|
||||||
|
|
||||||
RemoteDatabaseContext db = new RemoteDatabaseContext();
|
RemoteDatabaseContext db = new RemoteDatabaseContext();
|
||||||
Console.WriteLine("Enter path to file");
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
string? path = Console.ReadLine();
|
stringBuilder.Append("1. Print category");
|
||||||
if (path == null) return;
|
stringBuilder.AppendLine();
|
||||||
if (!bool.TryParse(Console.ReadLine(), out bool HaveHeader)) return;
|
stringBuilder.Append("2. Print rate");
|
||||||
StreamReader file = new StreamReader(path);
|
stringBuilder.AppendLine();
|
||||||
string row = String.Empty;
|
stringBuilder.Append("3. Print items");
|
||||||
if(HaveHeader) row = file.ReadLine();
|
Console.WriteLine(stringBuilder.ToString());
|
||||||
Console.WriteLine(row);
|
if (!int.TryParse(Console.ReadLine(), out int menuPosition))
|
||||||
while ((row = file.ReadLine()) != null)
|
|
||||||
{
|
{
|
||||||
var line = row.Split(',');
|
Console.WriteLine("Please enter a valid number");
|
||||||
if(!decimal.TryParse(line[2], out var decimalValue)) continue;
|
return;
|
||||||
RateDao dao = new RateDao
|
}
|
||||||
{
|
|
||||||
Name = line[0],
|
switch (menuPosition)
|
||||||
Color = line[1],
|
{
|
||||||
Rate = decimalValue
|
case 1:
|
||||||
|
foreach (var categoryDao in db.Categories)
|
||||||
};
|
{
|
||||||
db.Rates.Add(dao);
|
Console.WriteLine($"Id: {categoryDao.Id} Name: {categoryDao.Name}");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2: break;
|
||||||
|
default:
|
||||||
|
Console.WriteLine("Unkown Menu Position");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
db.SaveChanges();
|
|
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("LootBoxSimulator")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("LootBoxSimulator")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9c61ffba70b4d7b6c85c3d3d7b357920470df9fc")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1889ede86630630ebb95b23f978ced8ff8c96694")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("LootBoxSimulator")]
|
[assembly: System.Reflection.AssemblyProductAttribute("LootBoxSimulator")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("LootBoxSimulator")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("LootBoxSimulator")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
Loading…
Reference in New Issue
Block a user