public void Create(DogBarkViewModel viewModel) { if (string.IsNullOrWhiteSpace(viewModel.Bark)) throw new EmptyBarkException(); if (viewModel.Secret != DogTrainingSecret) throw new InvalidSecretException(); Barks.Add(new DogBarkModel { Bark = viewModel.Bark }); SaveChanges(); }
public void Create(DogBarkViewModel viewModel) { if (string.IsNullOrWhiteSpace(viewModel.Bark)) { throw new EmptyBarkException(); } if (viewModel.Secret != DogTrainingSecret) { throw new InvalidSecretException(); } Barks.Add(new DogBarkModel { Bark = viewModel.Bark }); SaveChanges(); }
public ActionResult Create(DogBarkViewModel model) { _DbContext.Create(model); return RedirectToAction("Index"); }