2024-12-16 06:29:02 +00:00
|
|
|
|
using System.Reflection.Emit;
|
|
|
|
|
using System.Runtime.InteropServices.ComTypes;
|
|
|
|
|
using LootBoxSimulator.Models.DAO;
|
2024-12-05 11:29:52 +00:00
|
|
|
|
|
|
|
|
|
RemoteDatabaseContext db = new RemoteDatabaseContext();
|
2024-12-16 06:29:02 +00:00
|
|
|
|
|
|
|
|
|
|
2024-12-16 06:32:08 +00:00
|
|
|
|
//add value
|
2024-12-16 06:29:02 +00:00
|
|
|
|
CategoryDao newCategory = new CategoryDao
|
|
|
|
|
{
|
|
|
|
|
Name = "epic"
|
|
|
|
|
};
|
2024-12-16 06:32:08 +00:00
|
|
|
|
db.Categories.Add(newCategory);
|
|
|
|
|
db.SaveChanges();
|
2024-12-16 06:29:02 +00:00
|
|
|
|
//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)
|
2024-12-05 11:29:52 +00:00
|
|
|
|
{
|
2024-12-16 06:29:02 +00:00
|
|
|
|
Console.WriteLine(categoryDao.Name);
|
|
|
|
|
}
|