public ActionResult Create(Zone zone) { if (ModelState.IsValid) { zoneRepository.InsertOrUpdate(zone); zoneRepository.Save(); return(RedirectToAction("Index")); } else { ViewBag.PossibleWaiters = waiterRepository.All; ViewBag.PossibleRestaurants = restaurantRepository.All; return(View()); } }
public ActionResult Create(Zone zone) { if (ModelState.IsValid) { zoneRepository.InsertOrUpdate(zone); zoneRepository.Save(); return(RedirectToAction("Index")); } else { ViewBag.PossibleAreas = areaRepository.All; ViewBag.PossibleViews = viewRepository.All; return(View()); } }
public Result Handle(CreateZoneCommand command) { var zone = new Zone(command.Name, command.Level, command.ZoneType); _zoneRepository.AddZone(zone); _zoneRepository.Save(); return(Result.Ok()); }