Exemplo n.º 1
0
        public ICommandResult Delete(Guid id)
        {
            DeleteHospitalCommand command = new DeleteHospitalCommand();

            command.Id = id;
            var result = _handler.Handle(command);

            return(result);
        }
Exemplo n.º 2
0
        public void Should_Delete_A_Hospital()
        {
            DeleteHospitalCommand command = new DeleteHospitalCommand()
            {
                HospitalId = hospitalRepository.hospitals.FirstOrDefault().Id
            };
            var result = (DeleteHospitalCommandResult)_handler.Handler(command);

            Assert.IsTrue(result.Deleted);
        }
Exemplo n.º 3
0
        public ICommandResult Handle(DeleteHospitalCommand command)
        {
            command.Validate();

            if (command.Invalid)
            {
                AddNotifications(command);
                return(new CommandResult(false, command.Notifications.Messages(), command));
            }

            _hospitalRepository.Remove(command.Id);

            _uow.Commit();

            return(new CommandResult(true, "Sucesso!", command));
        }
 public ICommandResult Handler(DeleteHospitalCommand command)
 {
     _hospitalRepository.Delete(command.HospitalId);
     return(new DeleteHospitalCommandResult(command.HospitalId, true));
 }
Exemplo n.º 5
0
 public async Task DeleteAsync(DeleteHospitalCommand deleted)
 {
     await _mediator.SendAsync(deleted);
 }