Пример #1
0
        static void SetMeals(string filename)
        {
            var lines = File.ReadAllLines(filename);

            for (var i = 0; i < lines.Length; i++)
            {
                var line = lines[i];
                //var value = line.Split(';');

                string name = line;
                Console.WriteLine(name);
                //string name = value[0];
                //double weight = Convert.ToDouble(value[1].Replace('.', ','));
                //double kcal = Convert.ToDouble(value[2].Replace('.', ','));
                //double protein = Convert.ToDouble(value[3].Replace('.', ','));
                //double fat = Convert.ToDouble(value[4].Replace('.', ','));
                //double carbs = Convert.ToDouble(value[5].Replace('.', ','));
                //string type = value[6];

                var newMeal = new Meals(name /*, weight, kcal, protein, fat, carbs, type*/);

                Console.WriteLine($"{i}.");

                MealsRepos.Insert(newMeal);
            }
        }
Пример #2
0
        private void Meal_button_Click(object sender, RoutedEventArgs e)
        {
            var name = MealName_textbox.Text;

            MealsRepos.Insert(new DAL.Entities.Meals(name, 0, 0, 0, 0, 0, "0"));
        }