Example #1
0
        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");

                            
            }
        }
Example #2
0
 private void CreateChef(Chef chef)
 {
     _chefRepository.Add(chef);
     _unitOfWork.Commit();
 }