public async Task <IActionResult> Edit(int id, [Bind("BiopsyID,PatientID,ClinicianID,RecordNumber,ServiceDate,BiopsySite,CreatedDate")] Biopsy biopsy)
 {
     if (id != biopsy.BiopsyID)
     {
         return(NotFound());
     }
     if (_context.Biopsies.Any(b => b.RecordNumber.Equals(biopsy.RecordNumber)))
     {
         ModelState.AddModelError("RecordNumber", "The Record Number existed in the system");
     }
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(biopsy);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!BiopsyExists(biopsy.BiopsyID))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Details), new { id = biopsy.BiopsyID }));
     }
     ViewData["ClinicianID"] = new SelectList(_context.Clinicians, "ClinicianID", "FullName", biopsy.ClinicianID);
     ViewData["PatientID"]   = new SelectList(_context.Patients, "PatientID", "FullName", biopsy.PatientID);
     return(View(biopsy));
 }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ClinicianID,FirstName,LastName,Address,PhoneNumber,CreatedDate")] Clinician clinician)
        {
            if (id != clinician.ClinicianID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clinician);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClinicianExists(clinician.ClinicianID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clinician));
        }
        public async Task <IActionResult> Edit(int id, [Bind("PatientID,FirstName,LastName,DateOfBirth,RegisterDate,CreatedDate")] Patient patient)
        {
            if (id != patient.PatientID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(patient);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PatientExists(patient.PatientID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(patient));
        }