public IActionResult NewChefSave(Chef newChef) { if (ModelState.IsValid) { { _chefRepository.Add(newChef); return RedirectToAction("Index"); } } else { // Oh no! We need to return a ViewResponse to preserve the ModelState, and the errors it now contains! return View("New"); } }
private void CreateChef(Chef chef) { _chefRepository.Add(chef); _unitOfWork.Commit(); }