// GET: Measurement/Edit/5 public async Task <IActionResult> Edit(int?id) { if (id == null) { return(View()); } var measurement = await _measurementRepository.GetMeasurementAsync((int)id); if (measurement == null) { return(View()); } var viewModel = new MeasurementViewModel { Name = measurement.Name, UnitsOfMeasurement = measurement.UnitsOfMeasurement }; return(View(viewModel)); }