コード例 #1
0
 // 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());
 }
コード例 #2
0
        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));
        }
コード例 #3
0
 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"));
 }
コード例 #4
0
        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));
        }
コード例 #5
0
        // 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));
        }
コード例 #6
0
        // 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));
        }
コード例 #7
0
        // 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));
        }