public IActionResult AddProblem(int PatientId) { var model = new AddProblemVM(); var user = _context.Patient.First(u => u.Id == PatientId); model.DOB = user.Dob; model.PatientId = PatientId; model.PatientName = user.FirstName + " " + user.LastName; return(View(model)); }
public async Task <IActionResult> AddProblem(AddProblemVM model) { var problem = new Problems(); problem.Active = true; problem.Date = DateTime.Now; problem.PatientId = model.PatientId; problem.ProblemName = model.ProblemName; problem.Approved = false; _context.Problems.Add(problem); await _context.SaveChangesAsync(); return(RedirectToAction("Problems", new { PatientId = model.PatientId })); }