public async Task <IActionResult> Edit(int id, [Bind("id,profile_id,medication,dosage,physician,last_dose,taking_as_prescribed,created_at,created_by")] mp_medication mp_medication) { if (id != mp_medication.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(mp_medication); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!mp_medicationExists(mp_medication.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["profile_id"] = new SelectList(_context.mp_profile, "id", "first_name", mp_medication.profile_id); return(View(mp_medication)); }