예제 #1
0
 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());
     }
 }
예제 #2
0
 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());
     }
 }
예제 #3
0
        public Result Handle(CreateZoneCommand command)
        {
            var zone = new Zone(command.Name, command.Level, command.ZoneType);

            _zoneRepository.AddZone(zone);
            _zoneRepository.Save();
            return(Result.Ok());
        }