public async Task <IActionResult> Edit(int id, [Bind("Id,Date,RecallDate,BatchNumber,PersonId,VaccineId")] Vaccinate vaccinate) { if (id != vaccinate.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vaccinate); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VaccinateExists(vaccinate.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PersonId"] = new SelectList(_context.Persons, "Id", "Firstname", vaccinate.PersonId); ViewData["VaccineId"] = new SelectList(_context.Vaccines, "Id", "Brand", vaccinate.VaccineId); return(View(vaccinate)); }
public Procedure CreateProcedure(string type) { Procedure procedure = null; switch (type) { case "Chip": procedure = new Chip(); break; case "DentalCare": procedure = new DentalCare(); break; case "Fitness": procedure = new Fitness(); break; case "NailTrim": procedure = new NailTrim(); break; case "Play": procedure = new Play(); break; case "Vaccinate": procedure = new Vaccinate(); break; } return(procedure); }
public string Vaccinate(string name, int procedureTime) { IAnimal animal = GetAnimal(name); IProcedure procedure = new Vaccinate(); MakeProcedure(procedureTime, animal, procedure); return($"{name} had vaccination procedure"); }
private void InitializeProcedures() { procedures["Chip"] = new Chip(); procedures["DentalCare"] = new DentalCare(); procedures["Fitness"] = new Fitness(); procedures["NailTrim"] = new NailTrim(); procedures["Play"] = new Play(); procedures["Vaccinate"] = new Vaccinate(); }
public AnimalCentre() { this.animalHotel = new Hotel(); this.chip = new Chip(); this.fitness = new Fitness(); this.dentalCare = new DentalCare(); this.nailTrim = new NailTrim(); this.play = new Play(); this.vaccinate = new Vaccinate(); }
public AnimalCentre() { hotel = new Hotel(); Adopted = new Dictionary <string, List <IAnimal> >(); chip = new Chip(); dental = new DentalCare(); fitness = new Fitness(); nailTrim = new NailTrim(); play = new Play(); vaccinate = new Vaccinate(); }
public AnimalCentre() { this.chip = new Chip(); this.vaccinate = new Vaccinate(); this.fitness = new Fitness(); this.play = new Play(); this.dentalCare = new DentalCare(); this.nailTrim = new NailTrim(); this.addoptedAnimals = new Dictionary <string, List <IAnimal> >(); this.hotel = new Hotel(); }
public string Vaccinate(string name, int procedureTime) { Vaccinate vaccinate = new Vaccinate(); var animal = this.hotel.Animals[name]; vaccinate.DoService(animal, procedureTime); this.proceduresAndItsAnimals["Vaccinate"].Add(animal); return($"{name} had vaccination procedure"); }
public AnimalCentre() { this.hotel = new Hotel(); this.animalFactory = new AnimalFactory(); this.chipped = new Chip(); this.dentalCared = new DentalCare(); this.fitnessed = new Fitness(); this.nailTrimmed = new NailTrim(); this.played = new Play(); this.vaccineted = new Vaccinate(); }
public AnimalCentre(Hotel hotel, Dictionary <string, List <IAnimal> > owners) { this.owners = owners; this.hotel = hotel; this.chip = new Chip(); this.vaccinate = new Vaccinate(); this.play = new Play(); this.nailTrim = new NailTrim(); this.dentalCare = new DentalCare(); this.fitness = new Fitness(); }
public async Task <IActionResult> Create([Bind("Id,Date,RecallDate,BatchNumber,PersonId,VaccineId")] Vaccinate vaccinate) { if (ModelState.IsValid) { _context.Add(vaccinate); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PersonId"] = new SelectList(_context.Persons, "Id", "Firstname", vaccinate.PersonId); ViewData["VaccineId"] = new SelectList(_context.Vaccines, "Id", "Brand", vaccinate.VaccineId); return(View(vaccinate)); }
public string Vaccinate(string name, int procedureTime) { string vaccinated = "Vaccinate"; CheckAnimalExist(name); Vaccinate vaccinate = new Vaccinate(); IAnimal animal = hotel.Animals.Values.FirstOrDefault(x => x.Name == name); vaccinate.DoService(animal, procedureTime); AddHistory(animal, vaccinated); return($"{name} had vaccination procedure"); }
public string Vaccinate(string name, int procedureTime) { IAnimal animal = GetAnimal(name, procedureTime); Vaccinate vaccinate = new Vaccinate(); vaccinate.DoService(animal, procedureTime); AddToHistory(vaccinate.GetType().Name, animal); string result = $"{animal.Name} had vaccination procedure"; return(result); }
public string Vaccinate(string name, int procedureTime) { CheckForAnimal(name); Vaccinate vaccinate = new Vaccinate(); Animal animal = hotel.Animals.Values.FirstOrDefault(x => x.Name == name); vaccinate.DoService(animal, procedureTime); if (!history.ContainsKey("Vaccinate")) { history.Add("Vaccinate", new List <Animal>()); } history["Vaccinate"].Add(animal); return($"{name} had vaccination procedure"); }
public string Vaccinate(string name, int procedureTime) { if (IsExistInHotel(name)) { throw new ArgumentException($"Animal {name} does not exist"); } Procedure procedure = new Vaccinate(); procedure.DoService(animalsInHotel[name], procedureTime); procedures.Add(procedure); string result = $"{name} had vaccination procedure"; return(result); }
public string Vaccinate(string name, int procedureTime) { AnimalDoesntExist(name); IAnimal animal = TakeAnimal(name); IProcedure vaccinate = new Vaccinate(); vaccinate.DoService(animal, procedureTime); AddTypeProcedure(vaccinate); return(string.Format( ConstantMessages.HadProcedure, animal.Name, "vaccination")); }
public AnimalCentre() { this.hotel = new Hotel(); this.factory = new AnimalFactory(); this.chip = new Chip(); this.care = new DentalCare(); this.fitness = new Fitness(); this.trim = new NailTrim(); this.play = new Play(); this.vac = new Vaccinate(); this.procedures = new List <Procedure>() { chip, care, fitness, trim, play, vac }; this.allAddoptedAnimals = new Dictionary <string, List <string> >(); }
public AnimalCentre(IHotel hotel, IProcedure procedure, Chip chip, DentalCare dentalcare, Fitness fitness, NailTrim nailtrim, Play play, Vaccinate vaccinate) { this.hotel = hotel; this.procedure = procedure; chip = new Chip(); dentalcare = new DentalCare(); fitness = new Fitness(); nailtrim = new NailTrim(); play = new Play(); vaccinate = new Vaccinate(); }
public string Vaccinate(string name, int procedureTime) { this.DoesExist(name); var animal = hotel.GetAnimal(name); if (this.procedures.Any(p => p.GetType().Name == "Vaccinate")) { this.procedures.First(p => p.GetType().Name == "Vaccinate") .DoService(animal, procedureTime); } else { Procedure procedure = new Vaccinate(); procedure.DoService(animal, procedureTime); this.procedures.Add(procedure); } return($"{name} had vaccination procedure"); }
public string Vaccinate(string name, int procedureTime) { if (!this.hotel.Animals.ContainsKey(name)) { throw new ArgumentException($"Animal {name} does not exist"); } var animal = this.hotel.Animals.First(x => x.Value.Name == name).Value; if (this.procedures.Any(x => x.GetType() == typeof(Vaccinate))) { this.procedures.First(x => x.GetType() == typeof(Vaccinate)).DoService(animal, procedureTime); } else { var vaccine = new Vaccinate(); vaccine.DoService(animal, procedureTime); this.procedures.Add(vaccine); } return($"{animal.Name} had vaccination procedure"); }
public Procedure CreateProcedure(string procedureType) { Procedure procedure = null; switch (procedureType) { case "Chip": procedure = new Chip(); break; case "DentalCare": procedure = new DentalCare(); break; case "Fitness": procedure = new Fitness(); break; case "NailTrim": procedure = new NailTrim(); break; case "Play": procedure = new Play(); break; case "Vaccinate": procedure = new Vaccinate(); break; default: throw new InvalidOperationException("Invalid procedure!"); } return(procedure); }