public IActionResult Edit(Car Car) { if (ModelState.IsValid) { repository.AddOrUpdate(Car); TempData["message"] = $"{Car.Name} has been saved"; return(RedirectToAction("Index")); } else // there is something wrong with the data values { return(View(Car)); } }