Exemple #1
0
        public async Task <IHttpActionResult> Put(DeActiveZoneCommand command)
        {
            var response = await
                           Bus.Send <DeActiveZoneCommand, DeActiveZoneCommandResponse>(command);

            return(Ok(response));
        }
        public async Task <DeActiveZoneCommandResponse> Handle(DeActiveZoneCommand 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.DeActive();
            return(new DeActiveZoneCommandResponse());
        }