示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,PatientID,CreatedDate,Weight_lb,Height_cm,Blood_Sugar,Blood_Pressure,Symptoms,Diagnosis,Prescription,Comments")] MedicalHistoryVM medicalHistoryVM)
        {
            if (id != medicalHistoryVM.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(medicalHistoryVM);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MedicalHistoryVMExists(medicalHistoryVM.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(medicalHistoryVM));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("ID,PatientID,CreatedDate,Weight_lb,Height_cm,Blood_Sugar,Blood_Pressure,Symptoms,Diagnosis,Prescription,Comments")] MedicalHistoryVM medicalHistoryVM)
        {
            if (ModelState.IsValid)
            {
                _context.Add(medicalHistoryVM);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(medicalHistoryVM));
        }