public static void Main() { //Database.SetInitializer(new MigrateDatabaseToLatestVersion<HospitalSystemDbContext, Configuration>()); // Importer.Create(Console.Out).Import(); // DataSearcher.Search(new HospitalSystemService()); try { var db = new HospitalSystemDbContext(); var pat = new Patient() { FirstName = "anna", LastName = "eliii", Age = 5 }; db.Patients.Add(pat); db.SaveChanges(); Console.WriteLine(db.Patients.Count()); } catch (Exception ex) { Console.WriteLine("here"); } }
public ActionResult Specialization(int id) { SpecializationVM model = new SpecializationVM(); model.doctor = repo.GetById(id); model.specialization = repo.GetSpecializationsByDoctorId(id); context.SaveChanges(); return(View(model)); }
public ActionResult Medicines(int id) { MedicineVM model = new MedicineVM(); model.patient = repo.GetById(id); model.medicine = repo.GetMedicineByPatientId(id); context.SaveChanges(); return(View(model)); }
public override ActionResult Edit(EditVM model) { Specialization item = model.Id == 0 ? new Specialization() : repo.GetById(model.Id); if (model.DoctorIds != null) { item.Doctors = doctorRepo.GetAll(c => model.DoctorIds.Contains(c.Id)); } context.SaveChanges(); return(base.Edit(model)); }
public override ActionResult Edit(EditVM model) { Medicine item = model.Id == 0 ? new Medicine() : repo.GetById(model.Id); if (model.PatientIds != null) { item.Patients = patientRepo.GetAll(c => model.PatientIds.Contains(c.Id)); } context.SaveChanges(); return(base.Edit(model)); }