public IHttpActionResult Delete(ClientRemoveCommand cmd) { var validator = cmd.Validate(); if (!validator.IsValid) { return(HandleValidationFailure(validator.Errors)); } return(HandleCallback(() => _clientService.Remove(cmd))); }
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); }
public bool Remove(ClientRemoveCommand cmd) { var client = _clientRepository.GetById(cmd.Id) ?? throw new NotFoundException(); return(_clientRepository.Remove(client)); }