示例#1
0
        public IHttpActionResult Delete(ClientRemoveCommand cmd)
        {
            var validator = cmd.Validate();

            if (!validator.IsValid)
            {
                return(HandleValidationFailure(validator.Errors));
            }

            return(HandleCallback(() => _clientService.Remove(cmd)));
        }
示例#2
0
 public void SetUp()
 {
     AutoMapperInitializer.Reset();
     AutoMapperInitializer.Initialize();
     _client         = ObjectMother.GetClientValid();
     _clientRegister = Mapper.Map <ClientRegisterCommand>(_client);
     _clientUpdate   = Mapper.Map <ClientUpdateCommand>(_client);
     _clientRemove   = Mapper.Map <ClientRemoveCommand>(_client);
     _mockRepository = new Mock <IClientRepository>();
     _service        = new ClientService(_mockRepository.Object);
 }
示例#3
0
        public bool Remove(ClientRemoveCommand cmd)
        {
            var client = _clientRepository.GetById(cmd.Id) ?? throw new NotFoundException();

            return(_clientRepository.Remove(client));
        }