Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("PrescriptionID,PrescriptionPatientID,PrescriptionName,PrescriptionPatientTrackingNumber,PrescriptionRefillQuantity,PrescriptionRefillRemaining,PrescriptionPillQuantity,PrescriptionPillQuantityRemaining,PrescriptionPillDose,PrescriptionExpireDate,PrescriptionEntryDate,PrescriptionNextRefillEnableDate,PrescriptionActive")] Prescription prescription)
        {
            if (id != prescription.PrescriptionID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(prescription);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PrescriptionExists(prescription.PrescriptionID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PrescriptionPatientID"] = new SelectList(_context.Patients, "PatientID", "PatientEmail", prescription.PrescriptionPatientID);
            return(View(prescription));
        }
        public async Task <IActionResult> Edit(int id, [Bind("TransactionID,TransactionAction,TransactionClass,TransactionClassAction,TransactionEntryDateTime,TransactionPatientID,TransactionIDType")] Transaction transaction)
        {
            if (id != transaction.TransactionID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(transaction);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TransactionExists(transaction.TransactionID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(transaction));
        }
        public async Task <IActionResult> Edit(int id, [Bind("PatientID,PatientFirstName,PatientLastName,PatientBirthDate,PatientEmail")] Patient patient)
        {
            if (id != patient.PatientID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    patient.PatientFullName = $"{patient.PatientLastName}, {patient.PatientFirstName}";
                    _context.Update(patient);
                    //await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PatientExists(patient.PatientID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(patient));
        }