From 81042a87fcbbd1f384f8aa3a6be4a29acd7c0d75 Mon Sep 17 00:00:00 2001 From: KP9lKk Date: Mon, 16 Dec 2024 09:29:02 +0300 Subject: [PATCH] add samples --- LootBoxSimulator/Program.cs | 35 +++++++++++++------ .../net8.0/LootBoxSimulator.AssemblyInfo.cs | 2 +- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/LootBoxSimulator/Program.cs b/LootBoxSimulator/Program.cs index 206538d..35c5446 100644 --- a/LootBoxSimulator/Program.cs +++ b/LootBoxSimulator/Program.cs @@ -1,14 +1,27 @@ -using LootBoxSimulator.Models.DAO; +using System.Reflection.Emit; +using System.Runtime.InteropServices.ComTypes; +using LootBoxSimulator.Models.DAO; RemoteDatabaseContext db = new RemoteDatabaseContext(); -String path = Console.ReadLine(); -StreamReader file = new StreamReader(path); -string line; -while ((line = file.ReadLine()) != null) + + + +CategoryDao newCategory = new CategoryDao { - var row = line.Split(";"); - CategoryDao categoryDao = new CategoryDao { Name = row[0]}; - db.Categories.Add(categoryDao); - db.SaveChanges(); -} -Console.WriteLine(file.ReadToEnd()); \ No newline at end of file + Name = "epic" +}; +//change value +var categoriesUpd = db.Categories.Find(3); +if(categoriesUpd == null) return; +categoriesUpd.Name = "rare"; +//remove value +var categories = db.Categories.Find(3); +if(categories == null) return; +db.Remove(categories); +db.SaveChanges(); + +//display value +await foreach (var categoryDao in db.Categories) +{ + Console.WriteLine(categoryDao.Name); +} \ No newline at end of file diff --git a/LootBoxSimulator/obj/Debug/net8.0/LootBoxSimulator.AssemblyInfo.cs b/LootBoxSimulator/obj/Debug/net8.0/LootBoxSimulator.AssemblyInfo.cs index a2b98b1..16f358d 100644 --- a/LootBoxSimulator/obj/Debug/net8.0/LootBoxSimulator.AssemblyInfo.cs +++ b/LootBoxSimulator/obj/Debug/net8.0/LootBoxSimulator.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("LootBoxSimulator")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+684a1ad6929b649ac97d03976112fc7cfccb5497")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+13f06cb083c5b4aeca07e78be088bd7df3d7e65d")] [assembly: System.Reflection.AssemblyProductAttribute("LootBoxSimulator")] [assembly: System.Reflection.AssemblyTitleAttribute("LootBoxSimulator")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]