public async Task <IActionResult> Show(int id) { //get current dependent using id var dependent = await _context.Dependent .SingleOrDefaultAsync(m => m.DependentId == id); //instantiate new model var model = new DependentSummaryViewModel(); //set model dependent model.Dependent = dependent; //calculate age for dependent int currentyear = DateTime.Now.Year; int Dependent_BirthYear = dependent.Birthday.Year; model.Age = currentyear - Dependent_BirthYear; //get dependent appointments by id model.Appointments = GetSummaryAppointments(id); //get model appointments by id model.Prescriptions = GetSummaryPrescriptions(id); return(View(model)); }
public async Task <IActionResult> Summary(int?id) { //gets the current user ApplicationUser user = await GetCurrentUserAsync(); var model = new DependentSummaryViewModel(); return(View(model)); }