public Task Delete(string id)
        {
            var command = new DeleteCountryCommand(id);

            _commandBus.ExecuteAsync(command).Wait();
            return(Task.CompletedTask);
        }
Esempio n. 2
0
        public async Task <APIResult> Delete([FromBody] DeleteCountryCommand command)
        {
            var rs = await mediator.Send(command);

            return(new APIResult()
            {
                Result = rs
            });
        }
Esempio n. 3
0
        public Task ExecuteAsync(DeleteCountryCommand command)
        {
            var locationDomain = new LocationDomain(_domainService.WriteService);

            locationDomain.DeleteCountry(command.Id);

            _domainService.ApplyChanges(locationDomain);
            return(Task.CompletedTask);
        }
Esempio n. 4
0
        public async Task <IActionResult> DeleteContry(Guid id)
        {
            var query = new DeleteCountryCommand {
                Id = id
            };
            var result = await _mediator.Send(query);

            return(NoContent());
        }
Esempio n. 5
0
        public async Task <IActionResult> DELETE_COUNTRY([FromBody] DeleteCountryCommand command)
        {
            var res = await _mediator.Send(command);

            if (!res.Status.IsSuccessful)
            {
                return(BadRequest(res));
            }
            return(Ok(res));
        }
        public async Task Delete_Country_With_Wrong_Id_Should_Throw_Exception()
        {
            var command = new DeleteCountryCommand
            {
                Id = -1
            };

            var commandHandler = new DeleteCountryCommandHandler(_context);

            await commandHandler.Handle(command, CancellationToken.None).ShouldThrowAsync <NotFoundException>();
        }
Esempio n. 7
0
        public async Task <IActionResult> DeleteCountry(string code)
        {
            NullGuard.NotNullOrWhiteSpace(code, nameof(code));

            IDeleteCountryCommand command = new DeleteCountryCommand
            {
                CountryCode = code
            };
            await _commandBus.PublishAsync(command);

            return(RedirectToAction("Countries", "Contact"));
        }
        public async Task Delete_Country_Should_Remove_Country_From_Database()
        {
            var command = new DeleteCountryCommand
            {
                Id = 1
            };

            var commandHandler = new DeleteCountryCommandHandler(_context);

            await commandHandler.Handle(command, CancellationToken.None);

            var result = _context.Countries
                         .Where(x => x.Id.Equals(command.Id))
                         .FirstOrDefault();

            result.ShouldBeNull();
        }
        public async Task <ActionResult> DeleteCountry([FromBody] DeleteCountryCommand request, CancellationToken cancellationToken)
        {
            var response = await Mediator.Send(request, cancellationToken);

            return(NoContent());
        }
 public async Task <IActionResult> Delete(
     [FromRoute] DeleteCountryCommand command)
 => await this.Send(command);