public string Database_Info() //use LINQ to Entities to query the data

        {
            string a = "";


            using (var db = new Input_Data())
            {
                Model_Input input = new Model_Input
                {
                    Name_Manufacturer = manufacturer,
                    Name_place        = place,
                    Fruit             = fruit,
                    Class             = klass,
                    Price             = price
                };
                db.Input.Add(input);


                db.SaveChanges();
                var query = from b in db.Input
                            orderby b.Name_Manufacturer
                            select b;
                WriteLine("Database is updated:");
                foreach (var b in query)
                {
                    WriteLine($"Name of manufacturer: {b.Name_Manufacturer}, place: {b.Name_place}, fruit: {b.Fruit} class: {b.Class}, price: {b.Price} code={b.Code}");
                }
                WriteLine("Press a key to exit...");
                ReadKey();
            }
            return(a);
        }
Exemplo n.º 2
0
        public double Database_Calculate() //use LINQ to Entities to query the data

        {
            using (var db = new Input_Data())
            {
                Model_Calculate input = new Model_Calculate
                {
                    Balance = deposit
                };

                db.Calculate.Add(input);

                db.SaveChanges();
                var query = from b in db.Calculate
                            orderby b.Balance
                            select b;
                WriteLine("Database is updated:");
                foreach (var b in query)
                {
                    WriteLine($"Balance is: {b.Balance}, ID={b.ID}");//based on inserted days in a month
                }
                WriteLine("Press a key to exit...");
                ReadKey();
            }
            return(deposit);
        }