Beispiel #1
0
        // GET: Patients/AddMeds/5
        public ActionResult AddMeds(int id)
        {
            PatientEditAddMeds viewModel = new PatientEditAddMeds(_context);

            // this is to assign the fields in the viewmodel with the information inside the input fields
            viewModel.PatientId = id;
            viewModel.StartDate = DateTime.Now;
            //viewModel.StopDate = DateTime.Now;
            return(View(viewModel));
        }
Beispiel #2
0
        public async Task <IActionResult> AddMeds(int id, PatientMedication patientmeds)
        {
            if (ModelState.IsValid)
            {
                _context.Add(patientmeds);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            PatientEditAddMeds viewModel = new PatientEditAddMeds(_context);

            return(View(viewModel));
        }