Example #1
0
        public async Task <IHttpActionResult> Put(ActiveZoneCommand command)
        {
            var response = await
                           Bus.Send <ActiveZoneCommand, ActiveZoneCommandResponse>(command);

            return(Ok(response));
        }
        public async Task <ActiveZoneCommandResponse> Handle(ActiveZoneCommand command)
        {
            var city = await _cityRepository.FindAsync(command.CityId);

            if (city == null)
            {
                throw new DomainException("شهر یافت نشد");
            }
            var zone = city.Zones.SingleOrDefault(p => p.Id == command.Id);

            if (zone == null)
            {
                throw new DomainException("منطقه یافت نشد");
            }
            zone.Active();
            return(new ActiveZoneCommandResponse());
        }