Exemplo n.º 1
0
        private static void AddGfxSettings()
        {
            Console.Clear();

            var gfxSettings = new GfxSettings();

            //Validate input
            Console.WriteLine("Name of setting: ");
            gfxSettings.Name = Console.ReadLine();
            Console.WriteLine("ClockFrequency of setting: ");
            gfxSettings.ClockFrequency = int.Parse(Console.ReadLine());
            Console.WriteLine("Voltage of setting: ");
            gfxSettings.Voltage = int.Parse(Console.ReadLine());
            Console.WriteLine("MemoryFrequency of setting: ");
            gfxSettings.MemoryFrequency = int.Parse(Console.ReadLine());
            Console.WriteLine("Wattage of setting: ");
            gfxSettings.Wattage = int.Parse(Console.ReadLine());

            try
            {
                using (var context = new CryptoStatisticsContext())
                {
                    context.GfxSettings.Add(gfxSettings);
                    context.SaveChanges();
                }
                ShowMainMenu();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        private static void ShowGfxSettings()
        {
            Console.Clear();
            List <GfxSettings> gfxSettings;

            using (var context = new CryptoStatisticsContext())
            {
                gfxSettings = context.GfxSettings.ToList();
            }

            foreach (var gfxSetting in gfxSettings)
            {
                Console.WriteLine($"Id: {gfxSetting.Id}");
                Console.WriteLine($"Name: {gfxSetting.Name}");
                Console.WriteLine($"ClockFrequency: {gfxSetting.ClockFrequency}");
                Console.WriteLine($"Voltage: {gfxSetting.Voltage}");
                Console.WriteLine($"MemoryFrequency: {gfxSetting.MemoryFrequency}");
                Console.WriteLine($"Wattage: {gfxSetting.Wattage}");
            }
        }