// GET: RendezVous/Create public IActionResult Create() { ViewData["Couleurs"] = Couleur.CreerSelectList(); ViewData["IdDocteur"] = new SelectList(_contextFactory.CreateDbContext().Docteurs, "Id", "NomComplet"); ViewData["IdDossierpatient"] = new SelectList(_contextFactory.CreateDbContext().Dossierpatients, "Id", "NomComplet"); return(View()); }
public async Task <IActionResult> Edit(int id, [Bind("Subject,Description,Start,End,ThemeColor,IsFullDay,IdDocteur,IdDossierpatient,Id")] RendezVous rendezVous) { if (id != rendezVous.Id) { return(NotFound()); } if (ModelState.IsValid) { try { CliniqueDbContext context = _contextFactory.CreateDbContext(); context.Update(rendezVous); await context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RendezVousExists(rendezVous.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Couleurs"] = Couleur.CreerSelectList(); ViewData["IdDocteur"] = new SelectList(_contextFactory.CreateDbContext().Docteurs, "Id", "NomComplet", rendezVous.IdDocteur); ViewData["IdDossier"] = new SelectList(_contextFactory.CreateDbContext().Dossierpatients, "Id", "NomComplet", rendezVous.IdDossierpatient); return(View(rendezVous)); }
public IActionResult CreatePartial(string date) { ViewData["DateEvent"] = date; ViewData["Couleurs"] = Couleur.CreerSelectList(); ViewData["IdDocteur"] = new SelectList(_contextFactory.CreateDbContext().Docteurs, "Id", "NomComplet"); ViewData["IdDossier"] = new SelectList(_contextFactory.CreateDbContext().Dossierpatients, "Id", "NomComplet"); return(PartialView("_CreateRendezVousPartial")); }
public async Task <IActionResult> Create([Bind("Subject,Description,Start,End,ThemeColor,IdDocteur,IdDossierpatient,Id")] RendezVous rendezVous) { if (ModelState.IsValid) { CliniqueDbContext context = _contextFactory.CreateDbContext(); context.Add(rendezVous); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Couleurs"] = Couleur.CreerSelectList(); ViewData["IdDocteur"] = new SelectList(_contextFactory.CreateDbContext().Docteurs, "Id", "NomComplet", rendezVous.IdDocteur); ViewData["IdDossier"] = new SelectList(_contextFactory.CreateDbContext().Dossierpatients, "Id", "NomComplet", rendezVous.IdDossierpatient); return(View(rendezVous)); }
// GET: RendezVous/Edit/5 public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var rendezVous = await _contextFactory.CreateDbContext().RendezVous.FindAsync(id); if (rendezVous == null) { return(NotFound()); } ViewData["Couleurs"] = Couleur.CreerSelectList(); ViewData["IdDocteur"] = new SelectList(_contextFactory.CreateDbContext().Docteurs, "Id", "NomComplet", rendezVous.IdDocteur); ViewData["IdDossier"] = new SelectList(_contextFactory.CreateDbContext().Dossierpatients, "Id", "NomComplet", rendezVous.IdDossierpatient); return(View(rendezVous)); }
// GET: RendezVous/Edit/5 public IActionResult Edit(int?id) { if (id == null) { return(NotFound()); } var rendezVous = _contextFactory.CreateDbContext().RendezVous.Include(d => d.Docteur).Include(p => p.Dossierpatient).Where(x => x.Id == id).FirstOrDefault(); if (rendezVous == null) { return(NotFound()); } ViewData["Couleurs"] = Couleur.CreerSelectList(); ViewData["IdDocteur"] = new SelectList(_contextFactory.CreateDbContext().Docteurs, "Id", "NomComplet", rendezVous.IdDocteur); ViewData["IdDossier"] = new SelectList(_contextFactory.CreateDbContext().Dossierpatients, "Id", "NomComplet", rendezVous.IdDossierpatient); return(PartialView("_ModalRendezVousPartial", rendezVous)); }
// GET: RendezVous/Delete/5 public async Task <IActionResult> Delete(int?id) { if (id == null) { return(NotFound()); } var rendezVous = await _contextFactory.CreateDbContext().RendezVous .Include(r => r.Docteur) .Include(r => r.Dossierpatient) .FirstOrDefaultAsync(m => m.Id == id); if (rendezVous == null) { return(NotFound()); } ViewData["Couleurs"] = Couleur.CreerSelectList(); ViewData["IdDocteur"] = new SelectList(_contextFactory.CreateDbContext().Docteurs, "Id", "NomComplet", rendezVous.IdDocteur); ViewData["IdDossierpatient"] = new SelectList(_contextFactory.CreateDbContext().Dossierpatients, "Id", "NomComplet", rendezVous.IdDossierpatient); return(View(rendezVous)); }