public void ShouldDeleteVendorWithApplication() { var newVendor = new Vendor { VendorName = "test vendor" }; var newApplication = new Application { ApplicationName = "test application", OperationalContextUri = OperationalContext.DefaultOperationalContextUri }; newVendor.Applications.Add(newApplication); Save(newVendor); var vendorId = newVendor.VendorId; var applicationId = newApplication.ApplicationId; applicationId.ShouldBeGreaterThan(0); Scoped <IUsersContext>(usersContext => { var deleteApplicationCommand = new DeleteApplicationCommand(usersContext); var deleteVendorCommand = new DeleteVendorCommand(usersContext, deleteApplicationCommand); deleteVendorCommand.Execute(vendorId); }); Transaction(usersContext => usersContext.Vendors.Where(v => v.VendorId == vendorId).ToArray()).ShouldBeEmpty(); Transaction(usersContext => usersContext.Applications.Where(a => a.ApplicationId == applicationId).ToArray()).ShouldBeEmpty(); }
public void ShouldDeleteVendorWithUser() { var newVendor = new Vendor { VendorName = "test vendor" }; var newUser = new VendorUser { FullName = "test user" }; newVendor.Users.Add(newUser); Save(newVendor); var vendorId = newVendor.VendorId; var userId = newUser.UserId; userId.ShouldBeGreaterThan(0); Scoped <IUsersContext>(usersContext => { var deleteVendorCommand = new DeleteVendorCommand(usersContext, null); deleteVendorCommand.Execute(vendorId); }); Transaction(usersContext => usersContext.Vendors.Where(v => v.VendorId == vendorId).ToArray()).ShouldBeEmpty(); Transaction(usersContext => usersContext.Users.Where(u => u.UserId == userId).ToArray()).ShouldBeEmpty(); }
public DeleteVendorResponse DeleteVendor(DeleteVendorRequest request) { var resp = new DeleteVendorResponse(); var command = new DeleteVendorCommand(request.VendorId); resp = _repository.ExecuteCommand(command) as DeleteVendorResponse; return resp; }
public void ShouldDeleteVendor() { var newVendor = new Vendor(); Save(newVendor); var vendorId = newVendor.VendorId; var deleteVendorCommand = new DeleteVendorCommand(TestContext, null); deleteVendorCommand.Execute(vendorId); TestContext.Vendors.Where(v => v.VendorId == vendorId).ShouldBeEmpty(); }
public void ShouldDeleteVendor() { var newVendor = new Vendor(); Save(newVendor); var vendorId = newVendor.VendorId; Scoped <IUsersContext>(usersContext => { var deleteVendorCommand = new DeleteVendorCommand(usersContext, null); deleteVendorCommand.Execute(vendorId); }); Transaction(usersContext => usersContext.Vendors.Where(v => v.VendorId == vendorId).ToArray()).ShouldBeEmpty(); }
public GlobalSettingsController(IMapper mapper , IGetVendorsQuery getVendorsQuery , AddVendorCommand addVendorCommand , DeleteVendorCommand deleteVendorCommand , IGetVendorByIdQuery getVendorByIdQuery , EditVendorCommand editVendorCommand , ICloudOdsSettingsService cloudOdsSettingsService , ITabDisplayService tabDisplayService , IGetClaimSetsByApplicationNameQuery getClaimSetsByApplicationNameQuery , GetAdminAppUsersQuery getAdminAppUsersQuery) { _mapper = mapper; _getVendorsQuery = getVendorsQuery; _addVendorCommand = addVendorCommand; _deleteVendorCommand = deleteVendorCommand; _getVendorByIdQuery = getVendorByIdQuery; _editVendorCommand = editVendorCommand; _cloudOdsSettingsService = cloudOdsSettingsService; _tabDisplayService = tabDisplayService; _getClaimSetsByApplicationNameQuery = getClaimSetsByApplicationNameQuery; _getAdminAppUsersQuery = getAdminAppUsersQuery; }
public Task <IResult> Handle(DeleteVendorCommand deleteVendorCommand, int id) { deleteVendorCommand.Execute(id); return(Task.FromResult(AdminApiResponse.Deleted("Vendor"))); }
public void Handle(DeleteVendorCommand command) { _vendorService.Delete(command.Id); _vendorService.Complete(); }
public void Delete(Guid id) { DeleteVendorCommand deleteVendorCommand = new DeleteVendorCommand(id); QueueSender.Send(deleteVendorCommand); }