コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,LastName,FirstMidName,EnrollmentDate")] Dietitian dietitian)
        {
            if (id != dietitian.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dietitian);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DietitianExists(dietitian.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(dietitian));
        }
コード例 #2
0
        public NutritionClinic SetUpTestClinic()
        {
            //Setting up employees
            Dietitian       sutDT = new Dietitian("sutDT", Employee.Positions.Dietitian);
            PersonalTrainer sutPT = new PersonalTrainer("sutPT", Employee.Positions.PersonalTrainer);
            //Setting up clinic
            NutritionClinic sutClinic = new NutritionClinic("sutClinic", sutDT, sutPT);

            return(sutClinic);
        }
コード例 #3
0
        public void SettingUpNutritionClinic_DietitianAndPTIsCorrect()
        {
            //Setting up employees
            Dietitian       sutDT = new Dietitian("sutDT", Employee.Positions.Dietitian);
            PersonalTrainer sutPT = new PersonalTrainer("sutPT", Employee.Positions.PersonalTrainer);
            //Setting up clinic
            NutritionClinic sutClinic = new NutritionClinic("sutClinic", sutDT, sutPT);

            Assert.AreEqual(sutDT, sutClinic.Dietitian);
            Assert.AreEqual(sutPT, sutClinic.PersonalTrainer);
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("ID,LastName,FirstMidName,EnrollmentDate")] Dietitian dietitian)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dietitian);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(dietitian));
        }
コード例 #5
0
        static void Main(string[] args)
        {
            //Setting up employees
            Dietitian       theDietitian       = new Dietitian("Louise", Employee.Positions.Dietitian);
            PersonalTrainer thePersonalTrainer = new PersonalTrainer("Mats", Employee.Positions.PersonalTrainer);
            //Setting up clinic
            NutritionClinic theClinic = NutritionClinic.CreateNutritionClinic("Kiwi Clinic", theDietitian, thePersonalTrainer);

            Client newClient = new Client("Helena", 1.75, 60.5, theDietitian, thePersonalTrainer);

            Console.WriteLine($"Welcome to the {theClinic.Name}. We will help you get fit in no time.");



            Console.WriteLine(theClinic.CurrentClient.Name);
        }
コード例 #6
0
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            //Setting up employees
            Dietitian       theDietitian       = new Dietitian("Mrs Lind", Employee.Positions.Dietitian);
            PersonalTrainer thePersonalTrainer = new PersonalTrainer("Arnold Schwarzenegger", Employee.Positions.PersonalTrainer);
            //Setting up clinic
            NutritionClinic theClinic = new NutritionClinic("Mayonaise Foundation", theDietitian, thePersonalTrainer);

            var input = new TextInput();
            var gui   = new ConsoleGUI()
            {
                Input = input
            };
            var sim = new MySimulation(input, theClinic);
            await gui.Start(sim);
        }