public ActionResult EditActivity(int id) { Activity activity = activitiesService.GetById(id); if (activity == null) { TempData["ErrorMessage"] = "There is no activity with this id"; return(RedirectToAction("Index", "Home")); } EditActivityViewModel viewModel = new EditActivityViewModel(); viewModel.ActivityId = activity.ActivityId; viewModel.Duration = activity.Duration; viewModel.Name = activity.Name; viewModel.Price = activity.Price; return(View(viewModel)); }