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)); }
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); }
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); }
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)); }
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); }
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); }